+ Reply to Thread
Results 1 to 13 of 13

Display autoFilter criteria

Hybrid View

  1. #1
    Registered User
    Join Date
    10-06-2007
    Posts
    3

    Question Display autoFilter criteria

    Ok here's my problem:
    I have a column of Store Names ie. Wal-Mart, Target, etc.
    When I apply the AutoFilter to display all Wal-Marts for example, I want a cell, we'll call it Cell:B4 on a different worksheet within the same workbook to display the name of the store selected in the AutoFilter (Wal-Mart in this example). I need that same cell to change anytime the AutoFilter is changed to another store.

    So, Cell:B4 should always display what the filter is set to ie. All; Wal-Mart; Target; or whatever store I choose.

    Can anyone help?

    Thanks in advance

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    So if your filter row is in Row 1, and your store name column is in column, then your formula in the other sheet could be as easy as: =Sheet1!A2 where Sheet1 is the name of the sheet with the filtering and A2 would be the first cell containing the filtered store name....
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    10-06-2007
    Posts
    3

    Thumbs down Tried That!

    Quote Originally Posted by NBVC
    So if your filter row is in Row 1, and your store name column is in column, then your formula in the other sheet could be as easy as: =Sheet1!A2 where Sheet1 is the name of the sheet with the filtering and A2 would be the first cell containing the filtered store name....
    That's where my problem is. When I apply the filter to the column with the store names, the row number isn't static. So if I reference A2, my result never changes. If I set my filter to show all Wal-Mart Stores, the first displayed row now changes to A335.

    If it helps at all I've attached a Demo Spreadsheet. Check out both sheets in the workbook. Try filtering by various store names and check out the result on sheet2.

    Thanks for your help.
    Attached Files Attached Files

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if this helps

    Code from this site

    http://www.j-walk.com/ss/excel/usertips/tip044.htm

    or Non VBA way instead of using filter use advance filter and reference that cell

    http://www.contextures.com/xladvfilter01.html

    VBA Noob
    Attached Files Attached Files
    Last edited by VBA Noob; 10-07-2007 at 07:53 AM.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Forum Contributor corinereyes's Avatar
    Join Date
    12-02-2003
    Location
    Philippines
    MS-Off Ver
    MS Excel 2016
    Posts
    520
    Hi MrGadget,

    Try the attached file. Made a little revision with the code.

    http://www.ozgrid.com/VBA/autofilter-criteria.htm

    VBA Nood,

    I'am using xl 2007 and the xl file you've attached is not working when i make a new filter (does not refresh). Correct me if im wrong. Thanks!
    Attached Files Attached Files
    Last edited by corinereyes; 10-07-2007 at 01:28 PM.
    Corine

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Is the same code as my link except someone has added the line

    Application.Volatile
    to force updates

    VBA Noob

  7. #7
    Registered User
    Join Date
    05-13-2010
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Display autoFilter criteria

    In Excel 2007 you can filter on multiple values rather than just two. However, VBA only has a Criteria2 property for a filter -- so you can't display more than two filter criterias even if you picked, for example, "1 OR 2 OR 3," etc.

    Is there any way to get this data in Excel 2007? The tool tip that you see when hovering over the autofilter arrow displays just what I need, so there's some way of doing this, though it may not be accessible via VBA.


    I really appreciate anyone's help. I filter many columns at the same time all day long at work and being able to quickly see the parameters would help enormously.

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Display autoFilter criteria

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

  9. #9
    Registered User
    Join Date
    06-30-2010
    Location
    Derby,England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Display autoFilter criteria

    How can I display the results without the =

    For example the output in Book1 displays =WAL-MART in the cell on shhet 2

    How can I get it to just display WAL-MART

  10. #10
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Display autoFilter criteria

    You might want to read NBVC's post before yours

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Display autoFilter criteria

    To make it official....

    ptwuk,

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

+ 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