Falkie

New Member
Joined
Mar 6, 2018
Messages
5
Good afternoon.

I have a question regarding the Learn Excel - Sync Slicers from Different Data Sets video. I am trying to figure out how to get this working with 3 slicers.

The slicer that I am trying to use as the operating slicer is called Slicer_Week. The other two are called Slicer_Week2 and Slicer_Week 3.

When I try to run this macro I get the errorcode 438 and points to the following line: sc2.SlicerItems(SI1.Week2).Selected = SI1.Selected

I have tried many things to get it working but without succes. Can anyone help me? Thanks in advance


Code:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
    Dim sc1 As SlicerCache
    Dim sc2 As SlicerCache
    Dim sc3 As SlicerCache
    Dim SI1 As SlicerItem
    Dim SI2 As SlicerItem
   
 
    ' These names come from Slicer Settings dialog box
    Set sc1 = ThisWorkbook.SlicerCaches("Slicer_Week")
    Set sc2 = ThisWorkbook.SlicerCaches("Slicer_Week2")
    Set sc3 = ThisWorkbook.SlicerCaches("Slicer_Week3")
 
 
    Application.ScreenUpdating = False
    Application.EnableEvents = False
 
    sc2.ClearManualFilter
    sc3.ClearManualFilter
   
 
    For Each SI1 In sc1.SlicerItems
            sc2.SlicerItems(SI1.Week2).Selected = SI1.Selected
           
       Next SI1
 
    For Each SI2 In sc1.SlicerItems
            sc3.SlicerItems(SI2.Week3).Selected = SI2.Selected
           
       Next SI2
      
 
    Application.EnableEvents = True
    Application.ScreenUpdating = True
End Sub
 
Last edited by a moderator:

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Welcome to the forum.

What is SI1.Week2 supposed to mean? A SlicerItem doesn't have a Week2 property. I suspect you meant SI1.Name instead.
 
Upvote 0
Welcome to the forum.

What is SI1.Week2 supposed to mean? A SlicerItem doesn't have a Week2 property. I suspect you meant SI1.Name instead.

Thank you for your quick reaction. Is it always supposed to be SI1.Name or does it depend on the name of the slicer?
 
Upvote 0
It should always be SI1.Name which returns the name of the item in the slicer, not the name of the slicer itself.
 
Upvote 0
Glad to help. :)
 
Upvote 0

Forum statistics

Threads
1,215,902
Messages
6,127,648
Members
449,394
Latest member
fionalofthouse

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