+ Reply to Thread
Results 1 to 5 of 5

Automatically set autofilter criteria based on name of column?

  1. #1
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Automatically set autofilter criteria based on name of column?

    There is a report that I run on a daily basis that uses the same autofilter criteria each time: Any column named "Unweighted" has to be greater than or equal 30, and any column named "Index" has to be greater than or equal to 100. I'm trying to figure out how to set those criteria instantly with a press of a button.

    Unfortunately, this report sometimes has more data or less data, so my subroutine needs to be dynamic.

    I know that I could create variables and manually step through until I reach a blank, but I'm wondering if there is a better way to do this? I'm just brainstorming here, but is it possible to tell VBA to identify all of those "Unweighted"/"Index" columns by name? i.e. "If an autofilter column is called "Unweighted", apply a >=30 filter", etc.

    This attachment should clarify:
    Example Data - Autofilter.xlsx

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Automatically set autofilter criteria based on name of column?

    try this macro:
    There must be no empty columns in your table.
    Titles are in row 3.
    It self-adjusts to data length.

    Please Login or Register  to view this content.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: Automatically set autofilter criteria based on name of column?

    That is PERFECT. Thanks!

  4. #4
    Forum Contributor
    Join Date
    02-15-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    141

    Re: Automatically set autofilter criteria based on name of column?

    Pierre, can you explain a bit about what you're doing with all of those IF statements? I'll have to customize a bit and want to understand what exactly you did.

  5. #5
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Automatically set autofilter criteria based on name of column?

    Here you are:
    Please Login or Register  to view this content.
    If you need some more help do not hesitate to ask

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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