excel refresh pivot table
Public Sub RefreshAllPivotTables()
Dim ws As Worksheet
Dim pt As PivotTable
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.PivotCache.Refresh
Next pt
Next ws
End Sub