VBA to select filter criteria without deselecting current criteria

jlal1990

New Member
Joined
Jul 13, 2019
Messages
7
Hi guys,

I currently have a sheet with a column that has different filterable criteria (eg Education, How to, Gaming, Style, Film)

I recorded a macro to filter by the criteria 'Film' - however I dont know how to make it so that if I make another macro for 'Gaming', it will not deselect 'Film'. The aim is that i will have two macros - one for film and one for gaming , and if i click both macros - both filters will be applied. If i click one, only that one will be applied etc.

This is what i have so far:

Sub FILMfilter()


Sheets("Master Locator Data").Select
ActiveSheet.Range("$A$1:$AQ$30000").AUTOfilter Field:=9, Criteria1:= _
"Film"
Sheets("Functions").Select

End Sub

Thanks again!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
have you tried selecting on both in your macro recording ? its should produce and AND Criteria2:= _
"Gaming"
 
Upvote 0
Thanks for your help! I have but i dont want it to always return those 2 results, i would like it to be adaptive. I would essentially like it to perform the same function via macro as filtering and selecting new options whilst keeping others active each time.
 
Upvote 0
three macro buttons, or a marker to direct how the macro records
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,180
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