Hello!
Hoping someone can help me as I've spent the past 5 hours trying different methods with no luck.
I've recorded the below macro and it works, however I'm trying to replace [2022-05-01T00:00:00] and [2023-05-01T00:00:00] with a reference to cells A1 and A2 (based on the month selected)
Hoping someone can help me as I've spent the past 5 hours trying different methods with no luck.
I've recorded the below macro and it works, however I'm trying to replace [2022-05-01T00:00:00] and [2023-05-01T00:00:00] with a reference to cells A1 and A2 (based on the month selected)
VBA Code:
Sub PivotMonth()
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[XXX Calendar].[XXX Fiscal Month].[XXX Fiscal Month]").VisibleItemsList = _
Array("[XXX Calendar].[XXX Fiscal Month].&[2022-05-01T00:00:00]", _
"[XXX Calendar].[XXX Fiscal Month].&[2023-05-01T00:00:00]")
End Sub