I have the following code to use auto filter to delete rows that have CusOrd in column B.
With ActiveSheet
.AutoFilterMode = False
With Range("B3", Range("B" & Rows.Count).End(xlUp))
.AutoFilter 1, "*CusOrd*"
On Error Resume Next
.Offset(1, 0).Resize(.Rows.Count - 1).SpecialCells(12).EntireRow.Delete
On Error GoTo 0
End With
.AutoFilterMode = False
End With
If there are no "CusOrd" to delete I get an error, even though I have the "On Error Resume Next". What is going wrong? I don't really know what the "On Error GoTo 0" means, I got this code from this message board. It was working great on everything up until this issue.
With ActiveSheet
.AutoFilterMode = False
With Range("B3", Range("B" & Rows.Count).End(xlUp))
.AutoFilter 1, "*CusOrd*"
On Error Resume Next
.Offset(1, 0).Resize(.Rows.Count - 1).SpecialCells(12).EntireRow.Delete
On Error GoTo 0
End With
.AutoFilterMode = False
End With
If there are no "CusOrd" to delete I get an error, even though I have the "On Error Resume Next". What is going wrong? I don't really know what the "On Error GoTo 0" means, I got this code from this message board. It was working great on everything up until this issue.