VBA to toggle table field filter criteria on and off

David Schaleger

Board Regular
Joined
Dec 6, 2010
Messages
55
I need VBA code to toggle specific filtering in one field of a table on and off.

I have a table where, in one field, I'm often toggling between the same specific criteria (let's say Crit1, Crit2 and Blanks) and clearing all filtering. If the filter criteria are not applied, then they need to be applied (and autofiltering turned on if it's not), and if they are applied, then all of the filtering for that field needs to be cleared (other field's filterings can remain, and autofiltering can remain on).

I've tried several examples, but all seem to pertain to non-table filtering; the fact that it's in a table seems to be trumping me up. I'd like to reference the filtered field by table/field name, rather than table/field index number, so that the code will work if fields are added, deleted, or moved.

Thank you
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,214,942
Messages
6,122,366
Members
449,080
Latest member
Armadillos

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