Sunday, November 19, 2006

Update All Pivot Tables in the Active Workbook

This sub updates all the pivot tables in the active workbook.

Sub UpdatePivotTables()
' Updates all the pivot tables in the ActiveWorkbook.
Application.ScreenUpdating = False
For Each pc In ActiveWorkbook.PivotCaches
pc.Refresh
Next
Application.ScreenUpdating = True
End Sub

2 comments:

Anonymous said...

hi, will this work for pivots ina SHARED workbook?
I use office 2003 and have discovered that i can't update the pivots now my workbook is shared.
i will try this.
thanks

Anonymous said...

ok i tried it and NO, you cannot use vba to update teh pivots ina shared workbook.
i went for teh other option and just created my reports in a seperate workbook that pull the data from teh shared workbook.