Connecting Pivot Tables Through Slicers after "show report page filters"

predzer

New Member
Joined
Jun 21, 2018
Messages
20
HI ALL!!

HELP ME PLEASE!

1) I am trying to create a separate Pivot Table for each pivot items using the below code.
PivotTable Name = PivotTable_UBT
Filter Item = Building

Code:
ActiveSheet.PivotTables("PivotTable_UBT").ShowPages PageField:="Building"

2) Now i want to connect all the pivottables through a slicer, recording macro did the job, BUT pivot tables are
named in series i.e, PivotTable1,PivotTable2,PivotTable3.. because of this I cannot repeat the macro. Below is the recorded macro.

Slicer required for "Type"

Code:
ActiveWorkbook.SlicerCaches("Slicer_Type").PivotTables.AddPivotTable ( _
        ActiveSheet.PivotTables("[B]PivotTable1[/B]"))
    ActiveWorkbook.SlicerCaches("Slicer_Type").PivotTables.AddPivotTable ( _
        ActiveSheet.PivotTables("[B]PivotTable2[/B]"))
    ActiveWorkbook.SlicerCaches("Slicer_Type").PivotTables.AddPivotTable ( _
        ActiveSheet.PivotTables("[B]PivotTable3[/B]"))

3) Is there a way/efficient code to create pivottables for each "Building" field and slice them through "Type" ? or how can i rename each pivottables using "for each.. next" loop or something?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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