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.
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.
Below are the steps you can use to make al pivot tables auto-refresh while opening a workbook.
- Select any of the pivot tables from your workbook.
- Right-click on it and select “PivotTable Options”.
- Go To Data Tab ➜ Tick Mark “Refresh Data When Opening A File”.
- 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
thanks! xx
I use CTRL+ALT+F5
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
not working this method
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.
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
>>>>>>>>>>>>>>>>>>>>>>>>>
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.
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?
Not Really. Which version of Excel you are using?
Tanks alot.
@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
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
Please check the link to “30 Pivot Table Tricks”: Page not found.
Carlos
Refresh All is just wonderful. Thanks.
I’m so glad you liked it. 🙂