trust you are well
I am trying to adapt some excisting reports in 2010 with slicers. As far as I could find out we can connect slicers with pivot connections if the slicers are based on the same sources/caches
if not we better work with codes
I have tried a lot to find solutions but unfortunately I do not succeed ..
some explanation :
In my file I have pivots based on "units"(file = cumul data units ) and all related pivots I can linked with the pivotconnection
for the sheet value it does not work for the source is different(source = file cumul data value)
I tried to do as follows : I created a sheet "menu" where all the slicers as based for the "units"
and a sheet "slv" with indentical "slicers " based on "values"
I have tried the code (in this worksheet )as below but it does not work ... it would make me happy and would give me the possibilities to work with better performance in future
Code: Select all
Option Explicit
Private Sub Workbook_SheetPivotTableUpdate(ByVal Sh As Object, ByVal Target As PivotTable)
Dim oSl As SlicerItem
If Sh.Name <> ActiveSheet.Name Then Exit Sub
If Sh.Name = "MENU" Then
With SlicerCaches("Slicer_Division")
For Each oSl In .SlicerItems
SlicerCaches("Slicer_Division1").SlicerItems(oSl.Caption).Selected = oSl.Selected
Next
End With
With SlicerCaches("Slicer_Category")
For Each oSl In .SlicerItems
SlicerCaches("Slicer_Category1").SlicerItems(oSl.Caption).Selected = oSl.Selected
Next
End With
With SlicerCaches("Slicer_Material_Group2")
For Each oSl In .SlicerItems
SlicerCaches("Slicer_Material_Group21").SlicerItems(oSl.Caption).Selected = oSl.Selected
Next
End With
With SlicerCaches("Slicer_Construction_Type\Calendar_month")
For Each oSl In .SlicerItems
SlicerCaches("Slicer_Construction_Type\Calendar_month1").SlicerItems(oSl.Caption).Selected = oSl.Selected
Next
End With
ElseIf Sh.Name = "slv" Then
With SlicerCaches("Slicer_Division1")
For Each oSl In .SlicerItems
SlicerCaches("Slicer_Division").SlicerItems(oSl.Caption).Selected = oSl.Selected
Next
End With
With SlicerCaches("Slicer_Category1")
For Each oSl In .SlicerItems
SlicerCaches("Slicer_Category").SlicerItems(oSl.Caption).Selected = oSl.Selected
Next
End With
With SlicerCaches("Slicer_Material_Group21")
For Each oSl In .SlicerItems
SlicerCaches("Slicer_Material_Group2").SlicerItems(oSl.Caption).Selected = oSl.Selected
Next
End With
With SlicerCaches("Slicer_Construction_Type\Calendar_month1")
For Each oSl In .SlicerItems
SlicerCaches("Slicer_Construction_Type\Calendar_month").SlicerItems(oSl.Caption).Selected = oSl.Selected
Next
End With
End If
End Sub