I am trying to filter Page filter which has date values. But I keep getting error when I use .PivotFilters.Add type:=xlBefore, value:="5/1/2015"
.
I also tried the code below:
Dim nd As Long
nd = CLng(Date - 90)
pvt.PivotFields("startdate").ClearAllFilters
pvt.PivotCache.Refresh
pvt.PivotFields("startdate").PivotFilters.Add Type:=xlBefore, Value:=nd
But now I am getting Named argument not found.
The PivotTable is created successfully but not filtered.
When a pivot field is used in the
Report Filter
filtering it is different than when it's aRow
orColumn Label
. See the code below to set your filter criteria on thestartdate
located in theReport Filter
.