How to use Criteria1:="" to NOT TAKE multiple criteria

anzer

Board Regular
Joined
Mar 5, 2015
Messages
67
Hello,

So I have set 3 dates like this in excel:
Dim TradeDate As Range
Set TradeDate = ActiveSheet.Range("AA1")
Dim TradeDate1 As Range
Set TradeDate1 = ActiveSheet.Range("AB1")
Dim TradeDate2 As Range
Set TradeDate2 = ActiveSheet.Range("AC1")

Then I have a pivot table with thew date on column 4 and I am trying to filter OFF those date
With one date it is easy as I can just put:
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=4, Criteria1:="<>"TradeDate
but it does not work with multiple criteria so I tried something like this and still not working

Selection.AutoFilter Field:=4, Criteria1:"<>" Array( _
TradeDate, TradeDate1, TradeDate2), Operator:=xlFilterValues

Any idea on what is wrong with the code?

Thank you
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
[FONT=&quot]Also, for the Pivot Table I need the results with the TradeDate, TradeDate1 and TradeDate2 so now I am using this code when I need those date[/FONT]
[FONT=&quot]Range("A1").Select[/FONT]
[FONT=&quot]Selection.AutoFilter Field:=4, Criteria1:=Array(TradeDate, TradeDateMoins1, TradeDateMoins2), Operator:=xlFilterValues[/FONT]
[FONT=&quot]
[/FONT]

[FONT=&quot]But I just need to figure out how to filter them out for the next step[/FONT]
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,190
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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