Unable to connect multiple charts to Slicer through VBA

aaBunny

New Member
Joined
Dec 4, 2018
Messages
1
Hi all,


I have written a code to link a slicer to multiple charts/graphs. But Unable to connect it because it shows ar error stating "Unable to get pivotTables property of the worksheet class". can anyone help me with this.
Below is the my code for connecting slicer with multiple charts/graphs. Here "Year" is the Slicer and "Slicer_Year" is the slicer name

ActiveSheet.Shapes.Range(Array("Year")).Select
ActiveWorkbook.SlicerCaches("Slicer_Year").PivotTables.AddPivotTable ( _
ActiveSheet.PivotTables("Linux"))
ActiveWorkbook.SlicerCaches("Slicer_Year").PivotTables.AddPivotTable ( _
ActiveSheet.PivotTables("Network"))
ActiveWorkbook.SlicerCaches("Slicer_Year").PivotTables.AddPivotTable ( _
ActiveSheet.PivotTables("Unassigned"))
ActiveWorkbook.SlicerCaches("Slicer_Year").PivotTables.AddPivotTable ( _
ActiveSheet.PivotTables("Windows"))

Thanks
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi,

I made a pivot and a slicer on Year column. I made another pivot from same data on same sheet than first pivot (data are not). I named the Pivot Unassigned. The slicer is not linked.
I then launched
Code:
ActiveWorkbook.SlicerCaches("Slicer_Year").PivotTables.AddPivotTable ( _
        ActiveSheet.PivotTables("Unassigned"))
when on pivot sheet and slicer is now linked to both tables.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top