VBA Disconnecting Slicer, updating Pivottable source, reconnecting Slicer

CowboyFlipflop

New Member
Joined
Aug 22, 2019
Messages
1
Hi guys,

I'm running into a little but of a problem that I'm hoping someone here can help me with.

On a daily report that I run I have 8 different PivotCharts from 8 different PivotTables, all from the same data source but displaying different parts of it. I also have one slicer and one timeline that are used to filter all 8 charts.

Here is my problem: Given that the report is updated daily, I have written a macro that automatically updates the pivot tables to include the newly added data. When there is no slicer or timeline it runs fine however when I add them in it gives me a Run Time Error 5.

Here is my question: What would be the best method for writing a vba code that will 1) Disconnect 8 pivot tables from a slicer that already exists 2) Update the data range on the pivot tables 3) Reconnect each pivot table back to the original slicer?

I've seen a few solutions through research but nothing that's exactly what I need and I'm tearing my hair out trying to figure it out. Hoping there's an obvious solution.

Thanks in advance!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,212,928
Messages
6,110,737
Members
448,295
Latest member
Uzair Tahir Khan

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