I have recorded a series of macros that involve using the Advanced Filter to filter columns for unique values. The macros have worked perfectly in Excel 2003, but when I try to use them in Excel 2007 or 2010 I'm receiving the following error message: "Run-time error '1004': AdvancedFilter method of Range class failed". The funny thing is, the macro will run but stall once it reaches the AdvancedFilter code (which is the last line of code). If I hit ESC to stop the macro, Excel shows a filtered list as if the macro had run correctly, but returns the error above. I've let the macro run for 20 minutes to see if it's a time issue and it will continue to stall on the AdvancedFilter code indefinitely. Note, in order to go from running the macros in 2003 to 2007/2010 I've changed all references of 65,536 rows to 1,048,576 rows within the code. Here's the code for one of the macros where this is occurring:
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Range("B2").Select
Sheets("MASTER").Select
Columns("B:B").Select
Selection.Copy
Sheets("Firm Func.").Select
Columns("C:C").Select
ActiveSheet.Paste
Sheets("MASTER").Select
Columns("I:I").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Firm Func.").Select
Columns("D:D").Select
ActiveSheet.Paste
Range("B2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=IF(RC[2]>"""",RC[2],RC[1])"
Range("B2").Select
Selection.Copy
Range("B3").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Paste
Columns("B:B").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("C:C").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Columns("C:C").Select
Selection.Delete Shift:=xlToLeft
Columns("B:B").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Is there some change that needs to be made in order for this to work in Excel 2007/2010?
Bookmarks