Table of Contents
Believe me, if you are able to refresh all the pivot tables at once it can save a lot of your time. Yes, that’s right. Just think like this. Suppose, 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 few ways that you can use it to automatically refresh it as well. In this post, We will share with you 3-simple ways which you can use it to refresh all the pivot tables in single click.
You can use “Refresh All” Button to Update all the Pivot Tables in the Workbook
To refresh all pivot tables in a workbook at once in Excel, you can use the Refresh All button on the Data tab of the ribbon. Here’s how:
Click the Data tab on the ribbon.
In the Data Tools group, click the Refresh All button.
Alternatively, you can use the keyboard shortcut Ctrl+Alt+F5 to refresh all pivot tables in a workbook.
You can also refresh a single pivot table by clicking the Refresh button on the Analyze tab of the ribbon (in the Data group) or by right-clicking the pivot table and selecting Refresh from the context menu.
Below steps you can use it to make all the 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 (MACRO) to Update All the Pivot Tables in a Single Click
Yes, you can use VBA code as well to refresh all pivot tables. All you have to do is just use below-mentioned code.
Sub RefreshCustomPivotTable()
With ActiveSheet
.PivotTables.RefreshTable
End With
End Sub
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.
If you want to refresh only specific Pivot Tables with VBA code
Below VBA code you can use to update specific pivot table.
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