I've built many macros but haven't edited so much. I'm trying to filter a spreadsheet in column B for "0", then delete all rows. what's happening is if there are no rows containing "0" in column B, the code ends up deleting all the data I want to keep. My code is:
ActiveSheet.ListObjects(1).Range.AutoFilter Field:=2, _
Criteria1:="=0", Operator:=xlAnd
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
ActiveSheet.ListObjects(1).Range.AutoFilter Field:=2
Columns("A:A").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.ColumnWidth = 8.5
ActiveWindow.LargeScroll ToRight:=-1
End Sub