I tried to delete some rows based on the values of cells but literally I don't know why it's not working. When I ran the Sub, all the rows were gone. That was not what I want.
Please take a look. (it works when the criteria are like numbers, not characters)
Thanks in advance.
jqzhang
Sub MuchBetterDelRows_S_Col()
On Error Resume Next
Range("A1").AutoFilter Field:=10, Criteria1:="<>""MA"""
If Err = 0 Then _
Range("A2", Range("A65536").End(xlUp)).SpecialCells(xlCellTypeVisible).EntireRow.Delete
On Error GoTo 0
ActiveSheet.AutoFilterMode = False
End Sub
Please take a look. (it works when the criteria are like numbers, not characters)
Thanks in advance.
jqzhang
Sub MuchBetterDelRows_S_Col()
On Error Resume Next
Range("A1").AutoFilter Field:=10, Criteria1:="<>""MA"""
If Err = 0 Then _
Range("A2", Range("A65536").End(xlUp)).SpecialCells(xlCellTypeVisible).EntireRow.Delete
On Error GoTo 0
ActiveSheet.AutoFilterMode = False
End Sub