Sync Slicers in Excel Error

daviserika

New Member
Joined
Jan 25, 2019
Messages
1
Caught the video on youttube which led me to this link: (https://www.mrexcel.com/news/sync-slicers-in-excel/). I pasted the code and it's crashing on me when it gets to the For Each line of the code, I get a runtime error '1004' application defined or object-defined error.

My code is barely modified from the example. What step did I miss?

I checked the slicer names and the ClearManualFilter is working so it's not that.

Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Dim sc1 As SlicerCache
Dim sc2 As SlicerCache
Dim SI1 As SlicerItem
Dim fred As SlicerItems

' These names come from Slicer Settings dialog box
Set sc1 = ThisWorkbook.SlicerCaches("Slicer_DMSL3")
Set sc2 = ThisWorkbook.SlicerCaches("Slicer_DMSL6")

Application.ScreenUpdating = False
Application.EnableEvents = False

sc2.ClearManualFilter

For Each SI1 In sc1.SlicerItems
sc2.SlicerItems(SI1.Name).Selected = SI1.Selected
Next SI1

Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,503
Messages
5,837,717
Members
430,512
Latest member
sciplants

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
Top