For certain types of data analysis, PivotTables can be very handy. If you have a workbook that contains several PivotTables, all based on the same data, you may wonder if there is a way to update them all at once, rather than going through them individually and updating them.
There is no Excel command that allows you to update all PivotTables, but you can create a short macro that will do the job for you. The following macro, RefreshAllPivots, steps through each worksheet in a workbook, checks to see if there are any PivotTables, and then updates them if there are.
Sub RefreshAllPivots() Dim wks As Worksheet Dim pt As PivotTable For Each wks In Worksheets For Each pt In wks.PivotTables pt.RefreshTable Next pt Next wks End Sub
If you do a lot of work with multiple PivotTables, you may want to assign the macro to a shortcut key or the Quick Access Toolbar so that you can run it easier.