Private Sub Workbook_SheetPivotTableChangeSync(ByVal Sh As Object, ByVal Target As PivotTable)
'Synchro des segments de la feuille nommée "pivots"
If Sh.Name <> "pivots" Then Exit Sub
For Each Seg In ActiveWorkbook.SlicerCaches
For Each PTlien In Seg.PivotTables
If PTlien = Target.Name Then
Application.EnableEvents = False
On Error GoTo Fin
For Each Seg2 In ActiveWorkbook.SlicerCaches
If Seg2.Name <> Seg.Name And (Left(Seg.Name, Len(Seg.Name)) = Left(Seg2.Name, Len(Seg2.Name) - 1) Or _
Left(Seg2.Name, Len(Seg2.Name)) = Left(Seg.Name, Len(Seg.Name) - 1)) Then
ActiveWorkbook.SlicerCaches(Seg2.Name).ClearManualFilter
For Each Iitem In ActiveWorkbook.SlicerCaches(Seg.Name).SlicerItems
ActiveWorkbook.SlicerCaches(Seg2.Name).SlicerItems(Iitem.Name).Selected = Iitem.Selected
Next Iitem
End If
Next Seg2
End If
Next PTlien
Next Seg
Fin:
Application.EnableEvents = True
End Sub