I’m pretty new to VBA and macros and I’m trying to delete rows if specific columns have certain values.
I tried different ways of doing it and I end up with a lot of headache.
I used other people codes but they were just to hard to understand what’s going on.
So I came up with this solution of solving the problem: I used Auto filter to select specific values and just deleted the rows.
Now I’m wondering why I don’t see other people use this solution?
Is there a major flaws in solving the problem this way?
If somebody has better and easier to understand solution will be glad to try using it.



What I did here is auto filter for column D and value 99 and deleted it and then column D and value blank and deleted it and finally column F and value 0 and deleted it.



Sub Macro2()
'
' Macro2 Macro
' Macro recorded 10/16/2008 by Preferred User
'
Cells.Select
Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:="99"
Rows("2:65536").Select
Selection.Delete Shift:=xlUp
Range("A1").Select
Selection.AutoFilter Field:=4
Selection.AutoFilter Field:=6, Criteria1:="0"
Rows("2:65536").Select
Selection.Delete Shift:=xlUp
Range("A1").Select
Selection.AutoFilter Field:=6
Selection.AutoFilter Field:=4, Criteria1:="="
Rows("2:65536").Select
Selection.Delete Shift:=xlUp
Range("A1").Select
Selection.AutoFilter Field:=4
'
End Sub