+ Reply to Thread
Results 1 to 8 of 8

Autofilter Criteria as String Value

  1. #1
    Registered User
    Join Date
    05-03-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Autofilter Criteria as String Value

    G'day and thanks in advance

    I have a list of stores in one table. I have Problem tickets with associated store numbers in another. I want to be able to press a button to autofilter by store number and have it cycle through the list i.e.

    Pr Store Store list
    A 1 1
    B 1 2
    C 1 3
    D 2 4
    E 2 5
    F 3 6
    G 5 7

    So I would push the button and it would filter all problems at store 1. Bush the button again and it would be store 2. Push again and store 3. The list to scroll through is Store List.

    I imagined I could use a for / next type loop and declare the autofilter criteria as a String - but I am hopelessly lost.

    Thanks heaps
    Last edited by petesguitar1; 05-04-2010 at 01:34 AM. Reason: formatting

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Autofilter Criteria as String Value

    Why not add a workbook?
    Providing a workbook will not only get you your answer quicker but will better illustrate your problem, usually when we can see your data (it can be dummy data but must be of the same type) and your structure it is far easier for us to give you a tailored, workable answer to your query
    Not all forums are the same - seek and you shall find

  3. #3
    Registered User
    Join Date
    05-03-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Autofilter Criteria as String Value

    Here is a simplified version, but should give you the idea. What I need to do is be able to Autofilter by FIRST_CONTACT_ID - The trick for me is to not have to scroll through the Autofilter box each time - I would like it to press a button and it would go onto the next unique FIRST_CONTACT ID and the associated problem numbers.
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Autofilter Criteria as String Value

    Here is a "rotateautofilter" macro and a "showall" macro attached to buttons on your sheet.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JBeaucaire; 05-04-2010 at 12:15 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    05-03-2010
    Location
    Ballarat, Australia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Autofilter Criteria as String Value

    Hey, thanks heaps. With a little tweaking this is working great.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Autofilter Criteria as String Value

    Yeah, I realized I misread which columns you wanted to filter by. I edited the macro to make it more robust and easy to edit.

    The final code is here.


    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-09-2017
    Location
    Italy
    MS-Off Ver
    2013
    Posts
    4

    Re: Autofilter Criteria as String Value

    Hi JB, this code looks great!
    1. However the main file for which I would use it, contains dates and I would like to auto-filter by progressive MONTH_YEAR, any idea how to make it? (Now it does not auto-filer even on Day_Month_Year level).
    2. Any chance that code would automatically recognize the active auto-filter column? i.e. without specifying it in VBA.
    3. Some tables do not start on row 1,any possibility that code would work also on tables starting on any row? Of course user would need to select the heather table cell that he/she is interested in auto-filtering.
    Many many thanks for your support/attention.
    Kr, estgas

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Autofilter Criteria as String Value

    estgas welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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