+ Reply to Thread
Results 1 to 2 of 2

Macro Autofilter with 2 field

Hybrid View

  1. #1
    Registered User
    Join Date
    06-22-2016
    Location
    Indonesia
    MS-Off Ver
    2013
    Posts
    1

    Macro Autofilter with 2 field

    Hi,

    I have a problem filter in macro. Any help would be much appreciated
    this is my code:

    ActiveSheet.Range("details").AutoFilter Field:=30, Criteria1:="USD", Operator:=xlAnd, Field:=12, Criteria1:=">5000000", Operator:=xlOr
    ActiveSheet.Range("details").AutoFilter Field:=30, Criteria1:="EUR", Operator:=xlAnd , Field:=12, Criteria1:=">7000000", Operator:=xlAnd

    How can I make a correct filter?

    Thank you

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Macro Autofilter with 2 field

    Autofilter does not work that way
    if you tried to do that manually you wouldnt be able to do that

    you need to either use a helper column to identify what to filter
    Formula: copy to clipboard
    =OR(AND(AD2="EUR",L2>7000000),AND(AD2="USD",L2>5000000))


    or use an advanced filter
    http://www.contextures.com/xladvfilter01.html
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

+ 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. Hello
    By tiii in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 06-22-2016, 11:44 PM
  2. [SOLVED] Hard coded field, AutoFilter field:=6 will break if user inserts a column before column F
    By mick0005 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-20-2015, 01:40 AM
  3. Autofilter Field with a variable?
    By kestefon in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-01-2013, 01:20 AM
  4. [SOLVED] Autofilter - Macro to Return Value in Userform Field based upon Most Recent Date
    By Southfish in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-01-2012, 12:57 AM
  5. [SOLVED] Macro to manually input which field (column) to autofilter on using an input prompt
    By rin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2012, 09:35 AM
  6. Autofilter with date field
    By gabch in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2006, 07:55 AM
  7. [SOLVED] Selection.AutoFilter Field:=1
    By MBlake in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-25-2005, 03:05 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