remy988
09-20-2013, 08:24 AM
hi,
i have the following code that does work, but what is the better way to code this?
Sub DelTest()
lastrw = Cells(Rows.Count, "a").End(xlUp).Row
For i = lastrw To 1 Step -1
If Range("a" & i).Value Like "*APPLE*" Then Rows(i).Delete Shift:=xlUp: GoTo nexti:
If Range("a" & i).Value Like "*ORANGE*" Then Rows(i).Delete Shift:=xlUp: GoTo nexti:
If Range("a" & i).Value Like "*BEAR*" Then Rows(i).Delete Shift:=xlUp: GoTo nexti:
nexti:
Next i
End Sub
thanks,
rem
i have the following code that does work, but what is the better way to code this?
Sub DelTest()
lastrw = Cells(Rows.Count, "a").End(xlUp).Row
For i = lastrw To 1 Step -1
If Range("a" & i).Value Like "*APPLE*" Then Rows(i).Delete Shift:=xlUp: GoTo nexti:
If Range("a" & i).Value Like "*ORANGE*" Then Rows(i).Delete Shift:=xlUp: GoTo nexti:
If Range("a" & i).Value Like "*BEAR*" Then Rows(i).Delete Shift:=xlUp: GoTo nexti:
nexti:
Next i
End Sub
thanks,
rem