+ Reply to Thread
Results 1 to 6 of 6

Loop through AutoFilter Items and Select/Deselect Desired Items

  1. #1
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,103

    Loop through AutoFilter Items and Select/Deselect Desired Items

    Hello Excel VBA gurus,

    I have data (numbers, text and even blanks) in column A

    The data in column A has a cell format shown in cell B4. Thus, if number is:

    Number in Excel (without cell format) Number shown in AutoFilter
    -150.29 (150)
    -0.99 (1)
    -0.000456854984 (0)
    0 -
    0.000123456 0
    1.123456 1
    SomeText SomeText

    What I'm trying to do here is to loop through AutoFilter items as shown in the AutoFilter (not in "raw" excel format - without custom format) and DESELECT "-", "Current & Prior", "Variance between" and (Blank)

    My 1st issue here is that, no matter how I try to google, it seems like there's no AutoFilter Items properties. The closest is to loop through the specified range and only picking the unique. But this is not the same as shown in the AutoFilter.

    My 2nd issue here is that with xlfilterValues operator, given my criteria to be an Array, it seems to accept if it's a '=' (equal) operator.

    If I were to modify and have it to be Criteria1:="<>" & Array( "-", "Current & Prior", "Variance between", "="), it won't work

    So my question is, how do I go about filtering out my desired array list?

    Thank you!

    Please Login or Register  to view this content.
    Loop through AutoFilter Items.png
    Attached Files Attached Files

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Loop through AutoFilter Items and Select/Deselect Desired Items

    Perhaps...
    Please Login or Register  to view this content.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,103

    Re: Loop through AutoFilter Items and Select/Deselect Desired Items

    Quote Originally Posted by sintek View Post
    Perhaps...
    Please Login or Register  to view this content.
    Hi Sitek,

    Isn't your code
    Please Login or Register  to view this content.
    filtering the values that I do not want to filter?

    The values that shown are the ones that I'd like to deselect from the autofilter if I were to do it manually

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Loop through AutoFilter Items and Select/Deselect Desired Items

    Apologies...Misunderstood...Are you wanting to delete all the numbers and keep everything else?

    Please Login or Register  to view this content.
    If not, please explain in more detail...perhaps upload a sample file with a before | expected after scenario...
    Last edited by Sintek; 03-02-2023 at 10:03 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,103

    Re: Loop through AutoFilter Items and Select/Deselect Desired Items

    The scenario is that I'd like the macro to click the "drop down" filter, and on the autofilter items, to DESELECT the items...and the items are "-", "Current & Prior", "Variance between", "="

  6. #6
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Loop through AutoFilter Items and Select/Deselect Desired Items

    The only other options left then are numbers > or < zero...post 4 does just that...
    If not, please explain in more detail...perhaps upload a sample file with a before | expected after scenario...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. I need to deselect 2 items from a filter
    By rosshkerr in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-03-2019, 01:44 AM
  2. Select/Deselect multiple items from data validation drop down
    By dsklein85 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2016, 11:17 AM
  3. Data Validation - Selecting multiple items with ability to deselect items
    By dsklein85 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-12-2016, 09:02 AM
  4. Replies: 0
    Last Post: 05-28-2015, 11:30 PM
  5. Select Multiple Items in a List and then Print Those Items
    By dcdoc in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-26-2013, 01:16 PM
  6. macro to filter all items in Autofilter except 2+ items
    By DanRiverBrew in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-09-2013, 09:15 PM
  7. Macro to deselect certain items
    By thedon_1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2011, 05:15 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1