Mathieu666
XLDnaute Nouveau
Bonjour, ma première publication de discussion! Merci d'avance!
Voilà mon problème: j'ai trois TCD qui doivent se filtrer à partir d'une cellule (B6), j'ai une macro qui le fait mais seulement pour un seul TDC. Comment pourrais-je modifier le code pour pouvoir le faire sur deux autres TDC?
Voici le code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Update by Extendoffice 20180702
Dim xPTable As PivotTable
Dim xPFile As PivotField
Dim xStr As String
On Error Resume Next
If Intersect(Target, Range("B6:B7")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Set xPTable = Worksheets("15021").PivotTables("Tableau croisé dynamique6")
Set xPFile = xPTable.PivotFields("Mesure")
xStr = Target.Text
xPFile.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
End Sub
Mathieu
Voilà mon problème: j'ai trois TCD qui doivent se filtrer à partir d'une cellule (B6), j'ai une macro qui le fait mais seulement pour un seul TDC. Comment pourrais-je modifier le code pour pouvoir le faire sur deux autres TDC?
Voici le code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Update by Extendoffice 20180702
Dim xPTable As PivotTable
Dim xPFile As PivotField
Dim xStr As String
On Error Resume Next
If Intersect(Target, Range("B6:B7")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Set xPTable = Worksheets("15021").PivotTables("Tableau croisé dynamique6")
Set xPFile = xPTable.PivotFields("Mesure")
xStr = Target.Text
xPFile.ClearAllFilters
xPFile.CurrentPage = xStr
Application.ScreenUpdating = True
End Sub
Mathieu