+ Reply to Thread
Results 1 to 4 of 4

VBA autofilter based on cell value

  1. #1
    Registered User
    Join Date
    12-02-2005
    Posts
    22

    VBA autofilter based on cell value

    Hi,

    I would like to autofilter based on a cell value using the filter "contains" as filter.

    In other words if I for instance want to search for all rows in an autofilter containing the word "VBA" (as an example"), where the value "VBA" has been written in a cell. How would I do that?

    I know that the code for "contains" would be

    Criteria1:="=*VBA*", Operator:=xlAnd

    and that the code for taken the value from a cell woud be:

    Criteria1:=Range("A1").Text

    So basically I need to combine the two above and are having difficulties doing it.

    Can anyone help?

    Thx. in advance

    Lars

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: VBA autofilter based on cell value

    Not tested but try this:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-02-2005
    Posts
    22

    Re: VBA autofilter based on cell value

    It worked.....thank you so much..

  4. #4
    Forum Contributor TechRetard's Avatar
    Join Date
    06-14-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    202

    Re: VBA autofilter based on cell value

    What if I wanted to do this automatically??

    i.e. I have a dropdown of words and table below the dropdown that is on autofilter. I select the word from the dropdown and the table automatically autofilters for that word -- "contains *listword* etc...


    any ideas?

+ 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