advanced filter criteria vba

daveyc18

Well-known Member
Joined
Feb 11, 2013
Messages
782
Office Version
  1. 365
  2. 2010
hi,

right now im using a named range for my advanced filter criteria, but then i tried making the range a TABLE and re-naming the table to the same same (i want to use a table so that it's dynamic if I add more criteria).

however, when I run the macro, the advanced filter doesn't work. does that mean it won't work with named tables and only named ranges?
 
sorry, missed a comma

=OFFSET(Sheet1!$A$1,0,0,MAX(COUNTA(Sheet1!$A:$A),COUNTA(Sheet1!$B$B),COUNTA(Sheet1!$C:$C)),3)
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
sorry, missed a comma

=OFFSET(Sheet1!$A$1,0,0,MAX(COUNTA(Sheet1!$A:$A),COUNTA(Sheet1!$B$B),COUNTA(Sheet1!$C:$C)),3)


for some reason it's not working...excel gives me an error...highlighting the "$B$B"
 
Last edited:
Upvote 0
Show us your entire script when you have it completed.

the main part of my code is this: Range("a1:an" & finalrow).AdvancedFilter Action:=xlFilterInPlace, criteriarange:=ThisWorkbook.Sheets("Maintenance").Range("Filter_All_Regions_Except_SB")



the named range "filter_all_regions_except_SB" is what andrex provided me:

=OFFSET(maintance!$A$1,0,0,MAX(COUNTA(maintenance!$A:$A),COUNTA(Sheet1!$B:$B),COUNTA(maintenance!$C:$C)),3)


which works out perfectly since my named range has 3 columns (A:C)
 
Last edited:
Upvote 0
Just thought I would like to see the entire code. But since you do not want to share that it's Ok.
I would have liked to have know what you were trying to do in it's entirety.
Take care.
 
Upvote 0
Just thought I would like to see the entire code. But since you do not want to share that it's Ok.
I would have liked to have know what you were trying to do in it's entirety.
Take care.

it's too long, lol...and im not at work ....it's essentially filtering for certain stuff from the raw data then just copy and pasting to my workbook
 
Upvote 0
it's too long, lol...and im not at work ....it's essentially filtering for certain stuff from the raw data then just copy and pasting to my workbook

Does advanced filter only work when the criteria is listed horizontally for Excel 2010?

e.g.

a1 = country
a2 = <>canada

b1 = country
b2 = <>US


at home, i used 2016 to test it out, it seemed like it worked fine if it was listed vertically

e.g.

a1 = country
a2 = <>canada
a3 = <>US
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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