J
J.W. Aldridge
Was given this code, but doesnt work. It deletes everything.
The data on the worksheet was imported - i think this has something to
do with the reason it doesnt work (or filter) properly.
Sub DeleteRows()
Dim LastRow As Long
Dim rw As Long
Application.ScreenUpdating = False
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
For rw = LastRow To 2 Step -1
If Cells(rw, "B").Value <> "Apples" Or Cells(rw, "B").Value
<>
"Oranges" Then
Rows(rw).Delete Shift:=xlUp
End If
Next rw
Application.ScreenUpdating = True
End Sub
The data on the worksheet was imported - i think this has something to
do with the reason it doesnt work (or filter) properly.
Sub DeleteRows()
Dim LastRow As Long
Dim rw As Long
Application.ScreenUpdating = False
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
For rw = LastRow To 2 Step -1
If Cells(rw, "B").Value <> "Apples" Or Cells(rw, "B").Value
<>
"Oranges" Then
Rows(rw).Delete Shift:=xlUp
End If
Next rw
Application.ScreenUpdating = True
End Sub