+ Reply to Thread
Results 1 to 7 of 7

Variable as the filter condition

  1. #1
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    Variable as the filter condition

    Good afternoon!

    I've attached a sample document to support my question.

    How can I change my autofilter code in order to filter for a variable? I essentially want it to loop through all of the customers on the "Reference" tab, filtering for the customer in Sheet 1 and pasting the selection in a new tab.
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Variable as the filter condition

    Hi,

    Why not keep things simple, more efficient and arguably much more useful and apply a Pivot Table to your data and use the PT to analyse your data - using PT Slicers if you want a really wizzzy presentation.

    Of course you could have a macro create new sheets for every customer but why duplicate all your data?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    Re: Variable as the filter condition

    Hi Richard, This loop criteria is part of a much larger code.

    I need to determine the answer to my initial question in order to get all of my files in working order.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Variable as the filter condition

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Variable as the filter condition

    Hi,

    I can't see any AutofilterCode!

  6. #6
    Forum Contributor
    Join Date
    11-05-2014
    Location
    Charlotte
    MS-Off Ver
    2013
    Posts
    181

    Re: Variable as the filter condition

    Perfect! Thank you, John!

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Variable as the filter condition

    You're welcome. Glad to help out and thanks for the feedback.

+ 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. [SOLVED] correctly 'wording' a for/next loop using a variable counter and variable filter
    By DBoyd121 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-14-2016, 06:13 PM
  2. Macro to filter a pivot whilst looping through filter criteria in a variable list.
    By Alistairm88 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2015, 04:25 AM
  3. Condition if variable different than x or y
    By AstroZelda in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-21-2015, 03:44 AM
  4. Pivot Table: OR condition filter on Multi Date/Sum Filter
    By ddalt10 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 11-09-2013, 12:49 PM
  5. Replies: 1
    Last Post: 10-27-2012, 02:54 AM
  6. [SOLVED] Max value in table IF variable condition met
    By FrankHouston in forum Excel General
    Replies: 7
    Last Post: 07-17-2012, 10:11 PM
  7. Filter Condition
    By shugg24 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2010, 10:16 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