Hi,
I need 4 pivot tables to set their criteria to match cell A1.
I have below code which is working great for the first pivot (Pivottabel2), but how do I add Pivottabel3, Pivottabel4 and Pivottabel1:
_______
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
Dim pt As PivotTable
Set pt = Worksheets("Fravær spec").PivotTables("Pivottabel2")
pt.ClearAllFilters
pt.PivotFields("personnummer").PivotFilters.Add Type:=xlCaptionContains, Value1:=Range("A1").Text
End Sub
_______
Thank you for your time
I need 4 pivot tables to set their criteria to match cell A1.
I have below code which is working great for the first pivot (Pivottabel2), but how do I add Pivottabel3, Pivottabel4 and Pivottabel1:
_______
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
Dim pt As PivotTable
Set pt = Worksheets("Fravær spec").PivotTables("Pivottabel2")
pt.ClearAllFilters
pt.PivotFields("personnummer").PivotFilters.Add Type:=xlCaptionContains, Value1:=Range("A1").Text
End Sub
_______
Thank you for your time