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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
[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,215,039
Messages
6,122,802
Members
449,095
Latest member
m_smith_solihull

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