advanced filter criteria vba

daveyc18

Well-known Member
Joined
Feb 11, 2013
Messages
755
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?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
A Table can be used as a dynamic named range. But do not give your Table and named range the same name.
Show me the script your trying to use.
 
Upvote 0
I deleted the original named ranged and used the same name for the table ...I'll post the code shortly
 
Upvote 0
A Table can be used as a dynamic named range. But do not give your Table and named range the same name.
Show me the script your trying to use.

Code:
        Range("a1:an" & finalrow).AdvancedFilter Action:=xlFilterInPlace, criteriarange:=ThisWorkbook.Sheets("Maintenance").Range("Filter_All_Regions_Except_SB")

Im thinking I need to modify the "RAnge("Filter..")" part since it's no longer a range and now actually a table???

also, when is a named range actually dynamic? Are they naturally dynamic in a sense when you move the data? e.g., move the named range from A1 to D2. But when you ADD data to the range, it's NOT dyanmic? i think that's what I noticed.
 
Upvote 0
I'm not able to help you without knowing what your trying to do.

I was just mentioning a table can be used as a dynamic name range.

For example create yourself a Table and give it any name you want.

Now write a small script which might say Range("John").select and run the script and see what happens.

Now add more data to the Range and then run your script again Range("John").select and you will see it now selects the enlarged range.
 
Upvote 0
That's exactly what I did ...but doesn't seem to work with a named table vs named range ...ill try again
 
Upvote 0
I'm not able to help you without knowing what your trying to do.

I was just mentioning a table can be used as a dynamic name range.

For example create yourself a Table and give it any name you want.

Now write a small script which might say Range("John").select and run the script and see what happens.

Now add more data to the Range and then run your script again Range("John").select and you will see it now selects the enlarged range.



ok, i just tried with a fresh workbook, making up my own data. advanced filter doesn't work with named tables, only named ranges.
 
Upvote 0
you can make a dynamic name range, that would solve the problem of adding data to your list
 
Upvote 0
Is it possible to make a dynamic range where its more than one column ?
 
Upvote 0
something like this should do the work

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

max will control the length of the table, the last digit how many column you have in the dynamic range
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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