Hey all,
I have been searching for a while, but I still have not found a working solution for my problem. Basically I have a pivot table over a huge data set consisting of all GL bookings from the past years. Now I want to filter the pivot table based on the date the GL bookings are posted.
The dates that I currently have in the pivot table are in cell C2, C3 and C4. When running the below code, the pivot table does filter on the dates in these three cells. However, it can be that I want to filter on -for example- 10 dates in cell C2 untill C11. For now, I manually have to adjust the code so it will contain every date filled in. But my question is, how can I make the coe dynamic so that the pivot table will be filtered on all values in C2 untill C..?
Many thanks for the help, support and -hopefully- an answer.
With kind regards,
Martin
I have been searching for a while, but I still have not found a working solution for my problem. Basically I have a pivot table over a huge data set consisting of all GL bookings from the past years. Now I want to filter the pivot table based on the date the GL bookings are posted.
The dates that I currently have in the pivot table are in cell C2, C3 and C4. When running the below code, the pivot table does filter on the dates in these three cells. However, it can be that I want to filter on -for example- 10 dates in cell C2 untill C11. For now, I manually have to adjust the code so it will contain every date filled in. But my question is, how can I make the coe dynamic so that the pivot table will be filtered on all values in C2 untill C..?
VBA Code:
ActiveSheet.PivotTables("PivotTable2").PivotFields( _
"[Finall Datum].[Hierarchy].[Datum]").VisibleItemsList = Array( _
"[Finall Datum].[Hierarchy].[Datum].&" & Range("C2").Value, _
"[Finall Datum].[Hierarchy].[Datum].&" & Range("C3").Value, _
"[Finall Datum].[Hierarchy].[Datum].&" & Range("C4").Value)
Many thanks for the help, support and -hopefully- an answer.
With kind regards,
Martin