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.
Recommended Productivity Tools for Excel
Office Tab: Bring powerful tabs to Office (include Excel), just like Chrome, Safari, Firefox and Internet Explorer. Save you half the time, and reduce thousands of mouse clicks for you. 30-day Unlimited Free Trial
Kutools for Excel: Save 71% of your time and solve 82% Excel problems for you. 300+ advanced tools designed for 1500+ work scenario, make Excel much easy and increase productivity immediately.60-day Unlimited Free Trial
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