Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Updating Multiple PivotTables at Once.

Updating Multiple PivotTables at Once

by Allen Wyatt
(last updated April 28, 2016)

9

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.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (5675) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Updating Multiple PivotTables at Once.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Inserting Different Dashes

Dashes have a lot of different uses in writing. Word supports three types of dashes, as discussed in this tip.

Discover More

Merging Only a Date from Access

When you are merging data from an Access database, you may get more information than you want, especially when it comes to ...

Discover More

Printing Shortcut Key Assignments from a Macro

Need to know what shortcut keys are defined? You can use a single macro command line to print out the definitions.

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Displaying a PivotTable's Name in the PivotTable

When you create a PivotTable, it can have a name. You may want this name to appear within the PivotTable itself. There is no ...

Discover More

Bogging Down with Calculated Items

Create a complex PivotTable and you may find that your system slows to a crawl. The reason for this may be due to the way in ...

Discover More

Weighted Averages in a PivotTable

PivotTables are used to boil down huge data sets into something you can more easily understand. They are very good simple ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 2 + 1?

2016-04-29 13:19:18

Michael (Micky) Avidan

@Wim Torfs,
In order to refresh ALL(!) Pivots in the selected Workheet you can use the following Macro:
---------------------------------------
Sub RefreshAllPivots()
For Each PT In ActiveWorkSheet.PivotCaches
PT.Refresh
Next
End Sub
---------------------------------------
If you need to refresh multiple pivots in Multiple Sheets - replace the: ActiveWorkSheet with: ActiveWorkbook
--------------------------
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2016)
ISRAEL


2016-04-28 08:49:13

Wim Torfs

Better place this macro in the sheet with your pivot tables

Private Sub Worksheet_Activate()
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
ActiveSheet.PivotTables("PivotTable2").PivotCache.Refresh
End Sub

Then the pivot tables are automatically refreshed


2016-04-28 08:33:16

Jeaux

LOVE your email tips, but I believe this is outdated. Refresh All works with one click- no need for a macro.


2016-04-28 08:03:27

Ricardo

Philip is right, all you need to do is refresh one, as long as they are linked to the same source data.

In Excel 2003 and previous versions, it also works if you link the second and next pivot tables to another PT.


2016-04-28 07:47:42

Philip

If you set create the 2nd, 3rd, ... pivot table by referring to the first one you create (they're all linking the same set of source data), then refreshing one pivot will refresh all in one go ...


2016-04-28 07:31:16

Michael (Micky) Avidan

As far as I recall, one doesn't need to use a ribbon option.
Hitting: Ctrl+Alt+F5 will "do the job".
--------------------------
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2016)
ISRAEL


2016-04-28 07:23:54

JoAnn Paules

Refresh All does that and even works on pivot tables on hidden sheets. I use that everyday. I think it was added in Excel 2007.


2015-11-23 14:07:46

kerry

Where do i go to add the macro? How do i do this? is there a link to where i can find this info on your site?
Thanks!


2013-09-25 14:28:26

Art

I don't get it. Why can't you just use the "Refresh All" button in the Data tab? Seems to work for me.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.