1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
If Target.Name <> "Tableau croisé dynamique1" Then Exit Sub
For Each Cas In ActiveWorkbook.SlicerCaches("Segment_Année").SlicerItems
If Cas.Selected = True Then
Application.ScreenUpdating = False
' Sheets("TCD").PivotTable.RowRange.Select
Sheets("TCD").Range("B8").Select 'te positionne dans le TCD ... A Adapter
ActiveCell.PivotTable.RowRange.Select
With Sheets("TCD").Cells.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent1
.TintAndShade = -0.499984740745262
.PatternTintAndShade = 0
End With
Exit For
Application.ScreenUpdating = True
End If
Next Cas
End Sub |