VBA to select filter criteria without deselecting current criteria
Results 1 to 4 of 4

Thread: VBA to select filter criteria without deselecting current criteria
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jul 2019
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post VBA to select filter criteria without deselecting current criteria

    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!

  2. #2
    Moderator mole999's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    9,819
    Post Thanks / Like
    Mentioned
    16 Post(s)
    Tagged
    2 Thread(s)

    Default Re: VBA to select filter criteria without deselecting current criteria

    have you tried selecting on both in your macro recording ? its should produce and AND Criteria2:= _
    "Gaming"
    • Yes I know there are better ways to do it. I just wish I knew them. - 97, 2003, 2007, 2010, 2013, 2016 & 2019
    • I wear my ignorance openly, excel is not my chosen career, its a means to an ends
    • Posting Guidelines Want to post well laid out questions and answers Translate Excel Versions
      Code:
      [CODE ]Put Your Code[/ CODE]
    • Settings > General Settings (on the left) scroll to the bottom, > Miscellaneous Options > Use ENHANCED
    • X-Posting Guidelines Rule 13 > CHART STUFF

  3. #3
    New Member
    Join Date
    Jul 2019
    Posts
    7
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA to select filter criteria without deselecting current criteria

    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.

  4. #4
    Moderator mole999's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    9,819
    Post Thanks / Like
    Mentioned
    16 Post(s)
    Tagged
    2 Thread(s)

    Default Re: VBA to select filter criteria without deselecting current criteria

    three macro buttons, or a marker to direct how the macro records
    • Yes I know there are better ways to do it. I just wish I knew them. - 97, 2003, 2007, 2010, 2013, 2016 & 2019
    • I wear my ignorance openly, excel is not my chosen career, its a means to an ends
    • Posting Guidelines Want to post well laid out questions and answers Translate Excel Versions
      Code:
      [CODE ]Put Your Code[/ CODE]
    • Settings > General Settings (on the left) scroll to the bottom, > Miscellaneous Options > Use ENHANCED
    • X-Posting Guidelines Rule 13 > CHART STUFF

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •