I have a pivot dashboard that is projecting Due/Overdue status for 3 tasks, measured in the following values:
In order to make the process easier for the user, I was looking to introduce a button to set all 3 slicers to show anything "overdue" only, the code for which is below. The code runs perfectly when all 3 "overdue" status appears for each of the 3 slicers.
The problem I have is when any of these "overdue" status is missing from the slicer, resulting in "Runtime Error 1004: Item could not be found in OLAP cube".
I am quite new to VBA, and having trouble setting the code to identify and filter any combination of "overdue" values. Would be glad to have some assistance to help develop the correct code that achieves this.
- Overdue >15 Months
- Overdue 14-15 Months
- Overdue 12-14 Months
- Due in 1-30 days
- Due in 31-90 days
- Record Up to Date
In order to make the process easier for the user, I was looking to introduce a button to set all 3 slicers to show anything "overdue" only, the code for which is below. The code runs perfectly when all 3 "overdue" status appears for each of the 3 slicers.
The problem I have is when any of these "overdue" status is missing from the slicer, resulting in "Runtime Error 1004: Item could not be found in OLAP cube".
I am quite new to VBA, and having trouble setting the code to identify and filter any combination of "overdue" values. Would be glad to have some assistance to help develop the correct code that achieves this.
VBA Code:
ActiveWorkbook.SlicerCaches("Slicer_MDT").VisibleSlicerItemsList _
= Array( _
"[Range].[MDT].&[Overdue >15 Months]", _
"[Range].[MDT].&[Overdue 14-15 Months]", _
"[Range].[MDT].&[Overdue 12-14 Months]")
ActiveWorkbook.SlicerCaches("Slicer_BRP").VisibleSlicerItemsList _
= Array( _
"[Range].[BRP].&[Overdue >15 Months]", _
"[Range].[BRP].&[Overdue 14-15 Months]", _
"[Range].[BRP].&[Overdue 12-14 Months]")
ActiveWorkbook.SlicerCaches("Slicer_BCE").VisibleSlicerItemsList _
= Array( _
"[Range].[BCE].&[Overdue >15 Months]", _
"[Range].[BCE].&[Overdue 14-15 Months]", _
"[Range].[BCE].&[Overdue 12-14 Months]")