jawaharprm
Member
Hi All,
i need to delete rows not match with this criteria
in E Column keep only contains "E3(, E4( & Rx(" other than like E1( ect or L"I1(1),LIVE(2),RX(1)" ect, should be delete i wrote the code but its delete all the rows expect header pls help same, enclosed sample data for reference
my code
i need to delete rows not match with this criteria
in E Column keep only contains "E3(, E4( & Rx(" other than like E1( ect or L"I1(1),LIVE(2),RX(1)" ect, should be delete i wrote the code but its delete all the rows expect header pls help same, enclosed sample data for reference
my code
Code:
Option Explicit
Sub E3_E4_RX()
Dim ws As Worksheet
Dim lastrow As Long
Dim i As Long
Dim val As String
Set ws = ThisWorkbook.Sheets("Technical sheet")
lastrow = ws.Cells(ws.Rows.Count, "E").End(xlUp).Row
For i = lastrow To 2 Step -1
val = LCase(Trim(ws.Cells(i, 5).Value))
If Not (InStr(val, "E3(" ) > 0 Or InStr(val, "E4(" ) > 0 Or InStr(val, "RX(" ) > 0) Then
ws.Rows(i).Delete
End If
Next i
End Sub