I recorded a macro to select the month in my olap cube pivot table:
ActiveSheet.PivotTables("BY_TYPE").PivotFields( _
"[ACCIDENT YEAR TRIANGLE D].[Development AGE].[Development AGE]").CurrentPage _
= "[ACCIDENT YEAR TRIANGLE D].[Development AGE].&[9]"
I want to reference a cell that has the value I want to use. I called it CurrMonth. I changed the logic to this:
CurrMonth = Range("CurrMonth").Value
ActiveSheet.PivotTables("BY_TYPE").PivotFields( _
"[ACCIDENT YEAR TRIANGLE D].[Development AGE].[Development AGE]").CurrentPage _
= "[ACCIDENT YEAR TRIANGLE D].[Development AGE].&[" & CurrMonth & "]"
It is giving me the following error: Run-time error '1004': Unable to set the CurrentPage property of the Pivot Field class
ActiveSheet.PivotTables("BY_TYPE").PivotFields( _
"[ACCIDENT YEAR TRIANGLE D].[Development AGE].[Development AGE]").CurrentPage _
= "[ACCIDENT YEAR TRIANGLE D].[Development AGE].&[9]"
I want to reference a cell that has the value I want to use. I called it CurrMonth. I changed the logic to this:
CurrMonth = Range("CurrMonth").Value
ActiveSheet.PivotTables("BY_TYPE").PivotFields( _
"[ACCIDENT YEAR TRIANGLE D].[Development AGE].[Development AGE]").CurrentPage _
= "[ACCIDENT YEAR TRIANGLE D].[Development AGE].&[" & CurrMonth & "]"
It is giving me the following error: Run-time error '1004': Unable to set the CurrentPage property of the Pivot Field class