happy_smiler1
New member
- Joined
- Aug 28, 2012
- Messages
- 67
- Reaction score
- 0
- Points
- 0
- Excel Version(s)
- office 365
Hi,
I am trying to get my pivot table to refresh automatically when new data has been entered and for the pivot to refresh automatically with the latest dated information as per my example.
I am completely stumped and have included the code below, please help.
Thanks.
Private Sub Worksheet_Activate()
Dim ptItem As PivotItem, sCurrent As String
sCurrent = UCase(Format(Date, "DATE"))
Application.ScreenUpdating = False
With ActiveSheet.PivotTables("PivotTable2").PivotFields("DATE")
.PivotItems(sCurrent).Visible = True
For Each ptItem In .PivotItems
If UCase(ptItem) <> sCurrent Then ptItem.Visible = False
Next ptItem
End With
Application.ScreenUpdating = True
End Sub
I am trying to get my pivot table to refresh automatically when new data has been entered and for the pivot to refresh automatically with the latest dated information as per my example.
I am completely stumped and have included the code below, please help.
Thanks.
Private Sub Worksheet_Activate()
Dim ptItem As PivotItem, sCurrent As String
sCurrent = UCase(Format(Date, "DATE"))
Application.ScreenUpdating = False
With ActiveSheet.PivotTables("PivotTable2").PivotFields("DATE")
.PivotItems(sCurrent).Visible = True
For Each ptItem In .PivotItems
If UCase(ptItem) <> sCurrent Then ptItem.Visible = False
Next ptItem
End With
Application.ScreenUpdating = True
End Sub