Results 1 to 3 of 3

Autofilter for more than 2 criteria in one column using VBA

Threaded View

  1. #1
    Registered User
    Join Date
    12-20-2005
    Posts
    44

    Autofilter for more than 2 criteria in one column using VBA

    I am trying to use VBA to filter a column for more than 2 criteria.

    I am using Excel 2003 currently.

    I know you can work around the 3 condition max rule in conditional formatting with VBA code, but can you do similar with Autofilter?

    e.g.

    This works for 2 criteria:

    Selection.AutoFilter Field:=9, Criteria1:="<>*SHOP*", Operator:=xlAnd, Criteria2:="<>*STOCK*"
    I tried to add another:

    Selection.AutoFilter Field:=9, Criteria1:="<>*SHOP*", Operator:=xlAnd, Criteria2:="<>*STOCK*", Criteria3:="<>*TOOL*"
    and I get Runtime Error: 1004, application-defined or object-defined error.

    I also know that I can create a helper column with a formula and filter by that... but wondering if there is a VBA trick out there.

    Thanks.
    Last edited by JohnnyBGood; 08-23-2011 at 11:19 AM.

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