Refresh All Pivot Tables at Once in Excel

puneet-gogia-excel-champs-09-06-23

- by Puneet

Believe me, if you can refresh all the pivot tables at once you can save a lot of time. Yes, that’s right. Just think like this. You have 10 pivot tables and to refresh a single pivot table it takes one sec.

10 Pivots = 10 Seconds

Just like you can automate to create a pivot table there are a few ways that you can use it to automatically refresh it as well. In this post, I’m gonna share with you 3-simple ways which you can use to refresh all the pivot tables and your time.

NOTE: Pivot Tables are one of the INTERMEDIATE EXCEL SKILLS.

Use the “Refresh All” Button to Update all the Pivot Tables in the Workbook

The “Refresh All” button is a simple and easy way to refresh all the pivot tables in a workbook with a single click.

Refresh All Pivot Tables Manually With Single Click

All you need to do it is Go to Data Tab ➜ Connections ➜ Refresh All.

Automatically Refresh All the Pivots When You Open a Workbook

If you want to refresh all pivot tables on opening a workbook you can use the following steps to make one time setup for that.

Refresh All Pivot Tables On Opening A File

Below are the steps you can use to make al pivot tables auto-refresh while opening a workbook.

  1. Select any of the pivot tables from your workbook.
  2. Right-click on it and select “PivotTable Options”.
  3. Go To Data Tab ➜ Tick Mark “Refresh Data When Opening A File”.
  4. Click OK.

VBA Code to Update All the Pivot Tables in a Single Click

Yes, you can use VBA as well to refresh all pivot tables. All you have to do is just use the below-mentioned code.

Sub RefreshCustomPivotTable()

With ActiveSheet
.PivotTables.RefreshTable
End With

End Sub

The above code will refresh all the pivot tables from your active worksheet and you can also assign this macro to a button to use in a single click.

Refresh Only Specific Pivot Tables with VBA

If you have some specific pivot tables which you want to update then you can use below VBA code.

Sub RefreshCustomPivotTable()

With ActiveSheet

.PivotTables("PivotTable1").RefreshTable
.PivotTables("PivotTable2").RefreshTable
.PivotTables("PivotTable3").RefreshTable
.PivotTables("PivotTable4").RefreshTable
.PivotTables("PivotTable5").RefreshTable

End With

End Sub

Change the name of the pivot tables as per your workbook. And, if you want to update these custom pivot tables every time when you open a workbook, change the name of the macro to auto_open

Sub auto_open()

With ActiveSheet
.PivotTables("PivotTable1").RefreshTable
.PivotTables("PivotTable2").RefreshTable
.PivotTables("PivotTable3").RefreshTable
.PivotTables("PivotTable4").RefreshTable
.PivotTables("PivotTable5").RefreshTable
End With

End Sub

More on Pivot Tables

  1. Connect a Single Slicer with Multiple Pivot Tables
  2. Automatically Update a Pivot Table Range
  3. Group Dates in a Pivot Table
  4. Pivot Table Timeline
  5. Pivot Table using Multiple Files
  6. Ranks in a Pivot Table 
  7. Running Total in a Pivot Table

15 thoughts on “Refresh All Pivot Tables at Once in Excel”

  1. Dear Paneet,

    I’m using Excel to monitor data with Exaquantum, to refresh data I must Select all then Delete then Undo.
    Could you please provide me with a simple trick to refresh my data easily.

    Many thanks
    Regards
    Imad

    Reply
  2. Comments:
    If ‘separate’ pivot tables then simple – data refresh all is simplest
    If pivot tables created ‘linked’ using same data then refresh on one pivot table sufficient to enable all associated pivot tables to be updated. (good practice)
    Option to have refresh set when opening file although it appears simple solution it can and ‘does’ result in a delay in opening files, hence first option ‘data refresh all’ avoids this problem.

    Reply
  3. Actually I found it useful to add the following code added to the Worksheet Activate event for every sheet containing pivot table/s:
    >>>>>>>>>>>
    For Each pt In ActiveSheet.PivotTables
    pt.PivotCache.refresh
    Next pt
    >>>>>>>>>>>>>>>>>>>>>>>>>

    Reply
    • This is also my usual method. Means you never look at a pivot table that is out of step with the data. Pity Excel does not give you that option natively, like it does at “open” time.

      Reply
  4. I’ve had refresh issues with power query and a pivot table whereby the details of the pivot table was cleared out with your suggestions. The only option was to use power pivot. I am guessing it is a sequence thing. Have you had any experience with this?

    Reply
  5. @Beth
    There’s just a minor typo in it. “PC” needs to be on the next line, so it reads “PC.Refresh”

    Sub RefreshAllPivots()
    Dim PC As PivotCache
    For Each PC In ActiveWorkbook.PivotCaches
    PC.Refresh
    Next PC
    End Sub

    Reply
  6. This code:
    Sub RefreshAllPivots()
    Dim PC As PivotCache
    For Each PC In ActiveWorkbook.PivotCachesPC
    .Refresh
    Next PC
    End Sub

    Returns “Compile error: Invalid or unqualified reference” on the .Refresh

    Reply

Leave a Comment