View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
J.W. Aldridge J.W. Aldridge is offline
external usenet poster
 
Posts: 425
Default delete all rows except

need to delete all rows except those containing "apples" and or
"oranges" in column G.

code below works, just need to add second criteria.
assuming that "a" would be changed to "g".


Sub Delete_Row()
For i = Cells(Rows.Count, "a"). _
End(xlUp).Row To 2 Step -1
If InStr(UCase(Cells(i, "a")), "MZ")<1 _
Then Rows(i).Delete
Next i
End Sub