Results 1 to 9 of 9
  1. #1
    Lounger
    Join Date
    Feb 2009
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have 6 filters across the top of my data
    I then used a certain criteria on filters 1 and 3
    How then, can I get the remaining non-duplicated items listed in filter 5?
    Is there a named collection series for each filter that can be accessed?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    What do you mean by "6 filters" - do you have an AutoFilter on 6 columns?

  3. #3
    Lounger
    Join Date
    Feb 2009
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='787579' date='04-Aug-2009 20:40']What do you mean by "6 filters" - do you have an AutoFilter on 6 columns?[/quote]

    Yes, using the AutoFilter on 6 columns.
    Point is, can I access the items listed within a particular filter using the collection?
    i.e. There's a shapes collection, is there a filter collection?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The AutoFilter object has a Filters collection, but the items of this collection describe the conditions, not the rows that have been filtered - see AutoFilter Object and Filters Collection Object.

    However, if you apply a filter, you can copy the filtered range and paste it elsewhere - only the visible cells will be copied. In VBA:

    ActiveSheet.AutoFilter.Range.Copy Destination:=ActiveSheet.Range("A100")

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    If you are trying to get at the contents of the filter dropdown list, then you are out of luck, I'm afraid. They are not programmatically exposed to VBA.
    Regards,
    Rory

    Microsoft MVP - Excel

  6. #6
    3 Star Lounger
    Join Date
    Nov 2002
    Location
    New York, New York, USA
    Posts
    266
    Thanks
    0
    Thanked 19 Times in 19 Posts
    [quote name='rory' post='787620' date='05-Aug-2009 05:25']If you are trying to get at the contents of the filter dropdown list, then you are out of luck, I'm afraid. They are not programmatically exposed to VBA.[/quote]


    Excel can provide that list which you could then reference in VBA.

    Using Advanced Filter set up the Criteria for Filter 5 to be * Leave all other Criteria Blank.
    Make sure in the Advance Filter Dialog Box to check the Unique Records Only
    Make sure to Copy the results to another location in the worksheet.
    Your results for the Filter 5 Output column should have the same names as the drop down. If you need them sorted just sort the output.
    Now you have a list in Excel you could prorammatically use in VBA.

    Good Luck.

    Tom Duthie

  7. #7
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    I must be missing something - what is that supposed to achieve?
    Regards,
    Rory

    Microsoft MVP - Excel

  8. #8
    3 Star Lounger
    Join Date
    Nov 2002
    Location
    New York, New York, USA
    Posts
    266
    Thanks
    0
    Thanked 19 Times in 19 Posts
    [quote name='rory' post='787732' date='06-Aug-2009 05:49']I must be missing something - what is that supposed to achieve?[/quote]


    Rory:

    I though the user wanted somewhere in Excel a list of the items in the filter drop down. The advanced filter can create a list that matches the list of names in the drop down. (without duplicates).

    Regards,

    Tom Duthie

  9. #9
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    Hi Tom,
    OK I see what you are doing. I think I interpreted the question slightly differently - I read it as the OP wanting the dynamically filtered list based on the other two filters already applied. Although you could do that with your method too, it would involve reading the applied filters, setting up the autofilter, applying it (thereby removing the autofilter) and then copying that to another location and reapplying the autofilter. Probably easier to just loop through the visible rows in the required column and add them to a Collection (using On Error Resume Next to skip duplicates)?
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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