Private Sub Workbook_SheetPivotTableUpdate(ByVal Sh As Object, ByVal Target As PivotTable)
'Synchro des segments de la feuille nommée "TCD"
If Sh.Name <> "Saad_Tcd_Heures" Then Exit Sub
On Error GoTo Fin
For Each Seg In ActiveWorkbook.SlicerCaches
For Each PTlien In Seg.PivotTables
If PTlien = Target.Name Then
Application.EnableEvents = False
For Each Seg2 In ActiveWorkbook.SlicerCaches
If Seg2.Name <> Seg.Name And Seg2.Name Like Seg.Name & "*" Then ActiveWorkbook.SlicerCaches(Seg2.Name).ClearManualFilter
Next Seg2
For Each Iitem In ActiveWorkbook.SlicerCaches(Seg.Name).SlicerItems
For Each Seg2 In ActiveWorkbook.SlicerCaches
If Seg2.Name <> Seg.Name And Seg2.Name Like Seg.Name & "*" Then ActiveWorkbook.SlicerCaches(Seg2.Name).SlicerItems(Iitem.Name).Selected = Iitem.Selected
Next Seg2
Next Iitem
Application.EnableEvents = True
End If
Next
Next
Fin:
Application.EnableEvents = True
End Sub