Hi everyone,
I m trying to build a macro in order to filter pivots based on a cell value. I have found the following coding on this forum but I don't understand why it triggers an error "1004 - Application-defined or object-defined error".
The cell value I m using for filter is a date, i.e. "06.09.2011".
I have noticed that If I do the same exercice but with text instead of date it works perfectly. Should be kind of format problem.
The code is the following (the underlined code is the one highlighted by the debugger) :
Sub VALUEFILTER()
Dim PT As PivotTable
Set PT = Sheets("Sheet2").PivotTables("PivotTable1")
PT.PivotFields("Value date").CurrentPage = Sheets("Sheet1").Range("H3").Value
Set PT = Nothing
Set PT = Sheets("Sheet3").PivotTables("PivotTable1")
PT.PivotFields("Value date").CurrentPage = Sheets("Sheet1").Range("H3").Value
Set PT = Nothing
End Sub
I precise that I m using Excel 2007.
Thanks in advance,
Scarface
Bookmarks