Sync Slicers in Excel

Bram1212

New Member
Joined
Apr 12, 2018
Messages
36
Hi!

I tried to use the sync slicers guide (https://www.mrexcel.com/news/sync-slicers-in-excel/) but it's not working for me.

This is the code I have:
Code:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
    Dim sc1 As SlicerCache
    Dim sc2 As SlicerCache
    Dim SI1 As SlicerItem


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


    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
The 2 slicers are on worksheet 1. The pivottables are on 6 other worksheets. So:
Worksheet 1: 2 slicers
Worksheet 2: 1 pivottable connected to slicer 1
Worksheet 3: 1 pivottable connected to slicer 1
Worksheet 4: 1 pivottable connected to slicer 1
Worksheet 5: 1 pivottable connected to slicer 2
Worksheet 6: 1 pivottable connected to slicer 2
Worksheet 7: 1 pivottable connected to slicer 2

Is that something I need to specify in the code?

Thanks!
 
Last edited by a moderator:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
OK, so the event is firing. It should be setting the slicer items in "Slicer_ISO_Year____Week____Day1" to the same ones selected in "Slicer_ISO_Year____Week____Day". Which slicer are you changing?
 
Upvote 0
I have tried changing both but none is effecting the other. Maybe something with the slicer name? If I change it to a invalid slicer name I do not get a error or something.
 
Upvote 0
That is strange - you should get an error if it's not a valid slicer name. Which version of Excel are you using?
 
Upvote 0
Not offhand. Can you censor the data and put the workbook on a hosting site (e.g. OneDrive or Dropbox) so I can have a look at it?
 
Upvote 0
Can you not upload it somewhere?
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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