This is the code I have, but the line Rows("4:858").Select
does not work well as the Filtered rows always varies. I think I need to use SpecialCells
(I have a header), but I want to ensure that only the Filtered rows are deleted and I am just learning Visual Basic. I used CurrentRegion
for filtering the data.
' Filters for location = blank or #N/A
ActiveSheet.Range("$A$3").CurrentRegion.AutoFilter Field:=5, Criteria1:="=#N/A", _
Operator:=xlOr, Criteria2:="="
' Selects all rows and deletes; NEED TO REPLACE THIS WITH MORE FLEXIBLE CODE
Rows("4:858").Select
Selection.Delete Shift:=xlUp
' Unfilters Location
Range("E2").Select
ActiveSheet.Range("$A$3").CurrentRegion.AutoFilter Field:=5
Any help with this code or even simplifying it would be greatly appreciated.