Auto Filter data with 2 different criteria

BombSheels

New Member
Joined
Apr 16, 2021
Messages
15
Office Version
  1. 365
Platform
  1. Windows
Hello, i have an excel macro file which I need to filter to 2 different criteria.
Criteria1 filter current year
Criteria2 filter specific words

But upon running the macro, it only displays 1 criteria
VBA Code:
With Sheet2.Range("A1:F50000")
   
    .AutoFilter Field:=6, _
                Operator:=xlFilterDynamic, _
                Criteria1:=xlFilterThisYear

    .AutoFilter Field:=6, _
               Criteria2:=Array("INCLUDE", "INCLUDE SA"), _
                Operator:=xlFilterValues

  End With

kindly help me. thank you
 
Last edited by a moderator:

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
You can't apply two different types of filter to the same field with an autofilter. You could use an advanced filter instead (which requires a criteria range).
 
Upvote 0
You can't apply two different types of filter to the same field with an autofilter. You could use an advanced filter instead (which requires a criteria range).
ok will try this one. thank you RoryA
 
Upvote 0

Forum statistics

Threads
1,214,638
Messages
6,120,676
Members
448,977
Latest member
moonlight6

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top