RapidFireGT
New Member
- Joined
- Mar 25, 2008
- Messages
- 26
The VBA below was created by recording a macro that applies AutoFilter to Column A, filters Column A for all rows containing the string “C U S T O M E R L I S T”, and then deletes all of those identified rows. This code executes successfully in Excel 2010 and 2013, but is generating the following error in Excel 2007:
The red text denotes the line of code that the debugger is calling out:
Any ideas why 2007 doesn't like this AutoFilter code, and what I can change to correct it?
Thanks in advance!
- Rob
“Run-time error ‘1004’: AutoFilter method of Range class failed
The red text denotes the line of code that the debugger is calling out:
Code:
' Removes all rows containing the "C U S T O M E R L I S T" header
With ActiveSheet
.AutoFilterMode = False
With Range("A1", Range("A" & Rows.Count).End(xlUp))
[COLOR=#ff0000] .AutoFilter 1, "*C U S T O M E R L I S T*"[/COLOR]
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
Any ideas why 2007 doesn't like this AutoFilter code, and what I can change to correct it?
Thanks in advance!
- Rob