Skip to main content

How to refresh pivot table when data changes in Excel?

Author: Sun Last Modified: 2014-08-07

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.

Refresh pivot table in a worksheet by pressing Refresh

Refresh pivot table in a worksheet or workbook with VBA


arrow blue right bubble Refresh pivot table in a worksheet by pressing Refresh

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:

doc-refresh-pivot-table-data-1

If you want to refresh all pivot tables in a single worksheet, you can select Refresh All.


arrow blue right bubble Refresh pivot table in a worksheet or workbook with VBA

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

Relative Articles:

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

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...

Description


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!
Comments (3)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Using Pivot Table I used your site to find out about preserving formatting when updating a Pivot Table. Issue however is that I noticed I had made an error in the formatting. How to I have my table save the new formatting rather than reverting back to the one with the error. Thanks.
This comment was minimized by the moderator on the site
il y a un probleme dans le code car sa actualise uniquement si on est present sur la sheet en question, or si on est dans un userform qui me donne les graphique , il actualise pas puisque nous somme pas sur activeSheet...
This comment was minimized by the moderator on the site
I LOVE this site!!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations