Need some help, just can't see what is wrong here. Trying to Filter a Pivot Table by date entered in Input Box. I keep getting error;
1004 Unable to set the PivotFields property of the PivotTable class.
However, my field is called "Financial Month" so have no idea why it isn't working.
My code is:
Sub Select_Pivot()
Dim DateSelect As String
DateSelect = InputBox(Prompt:="Search Date", Title:="Enter Date as <Month Year> i.e. May 2017")
Sheets("CPR").PivotTables("PivotTable1").PivotFields("Financial Month") = DateSelect
End Sub
Any ideas? Been trawling the internet and just can't find a solution. Greatly appreciate any advice here please.
?Sheets("CPR").PivotTables("PivotTable1").PivotFields("Financial Month").Name
+Enter, what do you get? – Excelosaurus.CurrentPage
as in(...).CurrentPage = DateSelect
; the default property for a PivotField is itsName
. If this doesn't work, please go to the Immediate Window and try?Sheets("CPR").Name
, then?Sheets("CPR").PivotTables("PivotTable1").Name
– Excelosaurus