Sub recup()
'
Dim tablo As PivotTable
Dim ref1, ref2 As PivotField
Dim valeur As PivotItem
Dim rang As Range
Dim client As String
Dim carte As Variant
Dim ok As Boolean
client = "Client B"
'
'
On Error Resume Next
With Sheets("Extraction")
.Select
With .PivotTables("TCD_extract").PivotFields("Clients")
.ClearAllFilters
For Each valeur In .PivotItems
If valeur = client Then
ok = True
Else
valeur.Visible = False
End If
Next valeur
If Not ok Then .ClearAllFilters: MsgBox "Pas de client à ce nom"
End With
End With
End Sub