M
Matthew Dyer
I'm trying to delete rows via results from a filter. The problem i'm running into is if there is no criteria that matches the filter then the header row is deleted. here's the Code i'm working with. Converttocol, lastcol and lastrow functions work fine. -
Set myrange = Range("A1:" & ConvertToCol(LastCol(ActiveSheet)) & lastrow(ActiveSheet))
myrange.AutoFilter
myrange.AutoFilter Field:=12, Criteria1:="=0", _
Operator:=xlOr, Criteria2:="=2E"
Range("A2:aq" & (lastrow(ActiveSheet) + 1)).SpecialCells(xlCellTypeVisible).Select
Selection.Delete
myrange.AutoFilter
Set myrange = Range("A1:" & ConvertToCol(LastCol(ActiveSheet)) & lastrow(ActiveSheet))
myrange.AutoFilter
myrange.AutoFilter Field:=12, Criteria1:="=0", _
Operator:=xlOr, Criteria2:="=2E"
Range("A2:aq" & (lastrow(ActiveSheet) + 1)).SpecialCells(xlCellTypeVisible).Select
Selection.Delete
myrange.AutoFilter