AdvancedFilter error message

Raybo

Board Regular
Joined
Mar 3, 2011
Messages
124
This code results in a message saying: "AdvancedFilter method of Range class failed".

I've been messing with this code for a couple of days now and can't figure out why it won't run. I've verified that the sheet names are the same as the ones in the code.

I'm trying to filter data from a main data sheet (BB DB) and have the filtered data sent to a separate sheet (0 x 0).

Cell "A11" is the top left cell in the list of data I want to filter, the column labels for the list are in "A10:N10". Range "A1:N2" is the filter criteria range, labels are in "A1:N1" and criteria for those labels are in "A2:N2". On sheet "0 x 0", range "A11:N11" is the labels that match the ones on sheet "BB DB".

Sub FilterBBDBToAll20PPGSheets()

Application.ScreenUpdating = False

Sheets("BB DB").Select
Range("G2").Select
ActiveCell.FormulaR1C1 = "=""=0 x 0"""
Sheets("BB DB").Range("A11").CurrentRegion.AdvancedFilter Action:=x1FilterCopy _
, CriteriaRange:=Sheets("BB DB").Range("A1:N2"), CopyToRange:= _
Sheets("0 x 0").Range("A11:N11"), Unique:=True
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
that should be xLFilterCopy not x(one)FilterCopy.

There may also be an issue if the .CurrentRegion has other 14 columns. (A11:N11 copy to range)
 
Upvote 0
Thanks Mike! Sure makes one feel stupid when one misses something like that.

It works fine now.

Much appreciated.
 
Upvote 0

Forum statistics

Threads
1,214,415
Messages
6,119,375
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top