+ Reply to Thread
Results 1 to 4 of 4

Autofilter not working with Multiple And Criteria

  1. #1
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Autofilter not working with Multiple And Criteria

    Hi, I am relatively not expert in vba so doen't understand what is happening here.

    My code works for one AND criteria as follows;

    Please Login or Register  to view this content.
    But following does not work when I add one more AND criteria.
    Please Login or Register  to view this content.
    Also following not working;
    Please Login or Register  to view this content.
    Last edited by caabdul; 03-05-2019 at 09:42 PM.

  2. #2
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Re: Autofilter not working with Multiple And Criteria

    I have realized that array is way to go for more than two criteria so I am using that now. But here is what I get;

    CASE 1:
    I use following code:
    Please Login or Register  to view this content.
    which given me an error "Autofilter method of range class failed".
    To resolve it I tried changing range to .Range("J" & StRw - 1) OR "Removing previous filters" but nothing works.

    CASE 2:
    I tried using the code;
    Please Login or Register  to view this content.
    which does not give any error but it ignores first 2 of the 3 criteria given in the array.

    Any suggestion?

    My End Result is deleting all rows except rows which contain any of Text1, Text2 or Text3 and I need it done in quickest way as data is huge.
    Last edited by caabdul; 03-05-2019 at 10:46 PM.

  3. #3
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Re: Autofilter not working with Multiple And Criteria

    Any solution for this issue?

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Autofilter not working with Multiple And Criteria

    You can not use wild cards for the criteria when array used.

    Try AdvancedFilter instead.

+ 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] AutoFilter - Criteria - Array - Range - Not working please assist.
    By kd7 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-22-2015, 08:34 AM
  2. Using VBA to AutoFilter Multiple Criteria
    By k9care in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2014, 05:59 AM
  3. [SOLVED] Multiple autofilter on one worksheet working around with combo box ?
    By amphinomos in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2014, 06:27 AM
  4. Autofilter criteria not working
    By Zeos6 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-06-2013, 05:49 PM
  5. VBA Autofilter multiple criteria
    By Daduka in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-29-2013, 08:36 AM
  6. [SOLVED] Autofilter with multiple criteria - how to ignore blank criteria
    By MOONDRIFT47 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-31-2012, 12:20 PM
  7. Multiple Criteria for Autofilter using And & Or
    By Wongadob in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2011, 01:39 PM

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