This macro was written to change the date in two pivot tables whenever a date is changed in a dropdown box. The date is a defined name range called "DteSelect." The two Pivot Tables and the Dropdown box are in the same sheet 'Dashboard.' The data is located in other sheets.
When the date is changed in the dropdown, the pivot tables report filter is pulling in the wrong date.
Any help to solve this would be appreciated!
Amber
When the date is changed in the dropdown, the pivot tables report filter is pulling in the wrong date.
Any help to solve this would be appreciated!
Amber
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim pvt As PivotTable
If Union(Target, Range("DteSelect")).Address = Range("DteSelect").Address Then
Worksheets("Dashboard").PivotTables("PivotTable1").PivotFields("Date").CurrentPage = Range("Date").Value
If Union(Target, Range("DteSelect")).Address = Range("DteSelect").Address Then
Worksheets("Dashboard").PivotTables("PivotTable6").PivotFields("Date").CurrentPage = Range("Date").Value
If Not Intersect(Target, Range("DteSelect")) Is Nothing Then
Application.Run "EquityChart"
End If
End If
Application.Run "PivotTable"
Sheets("Dashboard").Range("DteSelect").Select
Application.ScreenUpdating = True
End If
End Sub