How to refresh pivot table when data changes in Excel?
As you know, if you change the data in the original table, the relative pivot table does not refresh the data in it at the meantime. If you need to refresh the pivot table when data changes in table in Excel, I can tell you some quick ways.
In Excel, there is a Refresh and Refresh All function to refresh pivot table in a single worksheet.
Click a pivot table you want to refresh the data, and then click Option (in Excel 2013, click ANALYZE) > Refresh > Refresh. See screenshot:
If you want to refresh all pivot tables in a single worksheet, you can select Refresh All.
With VBA, you can not only refresh all pivot tables in a single worksheet, can also refresh all pivot tables in the whole workbook.
1. Press F11 + Alt keys together on the keyboard to open the Microsoft Visual Basic for Applications window.
2. Then click Insert > Module to insert a new module window. And then copy the follow VBA code to the window.
VBA: Refresh pivot tables in a worksheet.
Sub AllWorksheetPivots() 'Updateby20140724 Dim xTable As PivotTable For Each xTable In Application.ActiveSheet.PivotTables xTable.RefreshTable Next End Sub
3. Click Run button in the window or F5 key to running the VBA, then the pivot tables in a worksheet are refreshed.
Tip: To refresh all pivot tables in a whole workbook, you can use the follow VBA.
VBA: Refresh all pivot tables in a workbook.
Sub RefreshAllPivotTables() 'Updateby20140724 Dim xWs As Worksheet Dim xTable As PivotTable For Each xWs In Application.ActiveWorkbook.Worksheets For Each xTable In xWs.PivotTables xTable.RefreshTable Next Next End Sub
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!