Hi,
I have the following code in a macro.
(code)
With ActiveSheet
.AutoFilterMode = False
With Range("B4", Range("B" & Rows.Count).End(xlUp))
.AutoFilter 1, "*CusOrd*"
On Error Resume Next
.Offset(0).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
(code)
I want it to look at the range from B4 to the last cell in column B and delete all rows that have "CusOrd" for a value in column B. The problem is, if there are no rows with "CusOrd" in them, it will delete one of the top rows in the range B1 to B3. The offset was originally 1, but that would delete a row on the bottom that it shouldn't. How do I get it to just delete the rows with "CusOrd"? I'm not very familiar with this code (got it from a message board) or using Auto Filter in general, so any help would be greatly appreciated.
I have the following code in a macro.
(code)
With ActiveSheet
.AutoFilterMode = False
With Range("B4", Range("B" & Rows.Count).End(xlUp))
.AutoFilter 1, "*CusOrd*"
On Error Resume Next
.Offset(0).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
(code)
I want it to look at the range from B4 to the last cell in column B and delete all rows that have "CusOrd" for a value in column B. The problem is, if there are no rows with "CusOrd" in them, it will delete one of the top rows in the range B1 to B3. The offset was originally 1, but that would delete a row on the bottom that it shouldn't. How do I get it to just delete the rows with "CusOrd"? I'm not very familiar with this code (got it from a message board) or using Auto Filter in general, so any help would be greatly appreciated.