[B][COLOR=#0000cd] [/COLOR][/B][COLOR=#0000cd]Private Sub Worksheet_Change(ByVal Target As Range)
Dim sField As String, sDV_Address As String
Dim tField As String, tDV_Address As String
Dim uField As String, uDV_Address As String
Dim vPivots As Variant, i As Long
sField = "FROM" 'Field Name
sDV_Address = "$A$2" 'Cell with DV dropdown to select filter item.
tField = "TO" 'Field Name
tDV_Address = "$B$2" 'Cell with DV dropdown to select filter item.
uField = "YEAR" 'Field Name
uDV_Address = "$C$2" 'Cell with DV dropdown to select filter item.
On Error GoTo CleanUp
Application.EnableEvents = False
[B] vPivots = Array( _
Sheets("Sheet1").PivotTables("PivotTable1"), _
Sheets("Sheet1").PivotTables("PivotTable2"), _
Sheets("Sheet2").PivotTables("PivotTable3"), _
Sheets("Sheet2").PivotTables("PivotTable4"), _
) 'end Array
[/B]
For i = LBound(vPT_Names) To UBound(vPT_Names)
With vPivots(i)
Call Filter_PivotField( _
pvtField:=Sheet1.PivotTables("PivotTable1").PivotFields(sField), _
vItems:=Range(sDV_Address).Value)
Call Filter_PivotField( _
pvtField:=Sheet1.PivotTables("PivotTable1").PivotFields(uField), _
vItems:=Range(uDV_Address).Value)
Call Filter_PivotField( _
pvtField:=Sheet1.PivotTables("PivotTable1").PivotFields(tField), _
vItems:=Range(tDV_Address).Value)
Call Filter_PivotField( _
pvtField:=Sheet1.PivotTables("PivotTable2").PivotFields(sField), _
vItems:=Range(tDV_Address).Value)
Call Filter_PivotField( _
pvtField:=Sheet1.PivotTables("PivotTable2").PivotFields(uField), _
vItems:=Range(uDV_Address).Value)
Call Filter_PivotField( _
pvtField:=Sheet1.PivotTables("PivotTable2").PivotFields(tField), _
vItems:=Range(sDV_Address).Value)
Call Filter_PivotField( _
pvtField:=Sheet2.PivotTables("PivotTable3").PivotFields(sField), _
vItems:=Range(sDV_Address).Value)
Call Filter_PivotField( _
pvtField:=Sheet2.PivotTables("PivotTable3").PivotFields(uField), _
vItems:=Range(uDV_Address).Value)
Call Filter_PivotField( _
pvtField:=Sheet2.PivotTables("PivotTable3").PivotFields(tField), _
vItems:=Range(tDV_Address).Value)
Call Filter_PivotField( _
pvtField:=Sheet2.PivotTables("PivotTable4").PivotFields(sField), _
vItems:=Range(tDV_Address).Value)
Call Filter_PivotField( _
pvtField:=Sheet2.PivotTables("PivotTable4").PivotFields(uField), _
vItems:=Range(uDV_Address).Value)
Call Filter_PivotField( _
pvtField:=Sheet2.PivotTables("PivotTable4").PivotFields(tField), _
vItems:=Range(sDV_Address).Value)
End With
CleanUp:
Application.EnableEvents = True
End Sub
[/COLOR][B][COLOR=#0000cd][/COLOR][/B]