Hello my friends,
I have this VBA code to do it which I obtained here earlier.
Sub Column3DelRow(): Dim r As Long, n As Long, U As Range
r = Cells(Rows.Count, 3).End(xlUp).Row
For r = 1 To Cells(Rows.Count, 3).End(xlUp).Row
If InStr(1, Cells(r, 3), "apple") Or InStr(1, Cells(r, 3), "lemon") Or InStr(1, Cells(r, 3), "orange") Then
If U Is Nothing Then Set U = Cells(r, 3) _
Else Set U = Union(Cells(r, 3), U)
End If
Next r
If Not U Is Nothing Then U.EntireRow.Delete: Set U = Nothing
End Sub
Why it's If InStr(1, Cells(r, 3), "apple") ,not If InStr(2, Cells(r, 3), "apple")
I ran the code as "2" and it didn't work.
Bookmarks