You can make an Excel pivot table refresh automatically by enabling the built-in option for the workbook or by adding a short VBA macro that refreshes it when the file opens or on a timer. The exact steps differ slightly by Excel version and platform, but the core settings are the same. This guide covers both methods, plus what to check when the refresh does not happen.

What You'll Need

  • Excel for Windows or Mac (the automatic refresh option is not available in Excel for the web; you must refresh manually there).
  • A pivot table already created from a data source (table, range, or external connection).
  • For the macro method: the workbook saved as .xlsm (macro-enabled).

Step-by-Step

  1. Open the workbook containing your pivot table.
  2. Click any cell inside the pivot table. The PivotTable Analyze (or Analyze) tab appears on the ribbon.
  3. Go to PivotTable Analyze > Options (the small arrow next to Options opens a menu; choose Options again if needed). The PivotTable Options dialog opens.
  4. On the Data tab of that dialog, tick Refresh data when opening the file. This makes Excel refresh the pivot table every time the workbook is opened.
  5. Click OK. Save and close the workbook, then reopen it to confirm the refresh runs.

That setting handles refresh on open. If you need the pivot table to update while the workbook stays open (for example, when source data changes), use a macro:

  1. Press Alt+F11 (Windows) or Fn+Alt+F11 (Mac) to open the VBA editor.
  2. In the Project pane, double-click ThisWorkbook under your workbook name.
  3. Paste this code into the code window:
    Private Sub Workbook_Open()
        Dim ws As Worksheet
        Dim pt As PivotTable
        For Each ws In ThisWorkbook.Worksheets
            For Each pt In ws.PivotTables
                pt.RefreshTable
            Next pt
        Next ws
    End Sub
  4. Close the VBA editor and save the workbook as .xlsm.
  5. Reopen the workbook and enable macros when prompted. The pivot tables refresh on open.

For a timed refresh while the workbook is open, add a Workbook_Open macro that calls Application.OnTime to run a refresh procedure every few minutes. Keep the interval reasonable (e.g., 5–10 minutes) to avoid slowing Excel.

Common Mistakes

  • Using a range instead of a table. If the source data is a plain range, new rows are not included. Convert the source to an Excel Table (Ctrl+T) and refresh the pivot table; it will then pick up added rows.
  • Forgetting to enable macros. The macro method only works if macros are enabled for that workbook. If you see a security warning, click Enable Content.
  • Saving as .xlsx. Macros are removed when you save a macro-enabled workbook as .xlsx. Always use .xlsm.
  • Expecting refresh on open to update external data. If the pivot table uses an external connection, you may also need to set the connection to refresh on open (Data > Queries & Connections > right-click the connection > Properties > tick Refresh data when opening the file).
  • Refreshing a pivot table that is not connected to the intended data. Check the source range in PivotTable Analyze > Change Data Source.

Tips

  • Use Refresh All (Data > Refresh All) to update every pivot table and connection at once.
  • If your source data is large, avoid refreshing on open; it slows file opening. Instead, refresh manually or use a macro with a longer interval.
  • For pivot tables based on Power Query, set the query to refresh on open (Data > Queries & Connections > right-click the query > Properties > Refresh data when opening the file).
  • Test the macro on a copy of the workbook before relying on it.

Troubleshooting

If the pivot table does not refresh automatically:

  • Check the setting again. Open PivotTable Options > Data tab and confirm the box is ticked.
  • Enable macros. If you used VBA, make sure macros are enabled (File > Options > Trust Center > Trust Center Settings > Macro Settings). Choose “Disable all macros with notification” and click Enable Content when prompted.
  • Verify the source data. If the source range does not include new rows, the pivot table will not show them. Convert the source to a table or update the range.
  • Check external connections. For external data, open Data > Queries & Connections, right-click the connection, choose Properties, and tick “Refresh data when opening the file”.
  • Test in a new workbook. If the issue persists, create a simple pivot table and test the setting to isolate the problem.
  • Excel for the web limitation. Automatic refresh on open is not available in Excel for the web. Use the desktop app or refresh manually.

Frequently Asked Questions

Can I make a pivot table refresh automatically without VBA?

Yes. Use PivotTable Options > Data tab > tick “Refresh data when opening the file”. This refreshes the pivot table each time the workbook is opened.

Does the refresh-on-open setting work in Excel for Mac?

Yes, the option is available in Excel for Mac (version 2016 and later). The menu path is similar: PivotTable Analyze > Options > Data tab.

Why does my pivot table not include new rows after refresh?

The source range likely does not cover the new rows. Convert the source to an Excel Table (Ctrl+T) and refresh; the pivot table will then include added rows automatically.

Can I refresh a pivot table on a timer?

Yes, with a VBA macro using Application.OnTime. Set a reasonable interval (e.g., every 5–10 minutes) to avoid performance issues.

Does automatic refresh work in Excel for the web?

No. Excel for the web does not support automatic refresh on open. You must refresh manually (Data > Refresh All) or use the desktop app.

What happens if I save a macro-enabled workbook as .xlsx?

The macros are removed. Save as .xlsm to keep the automatic refresh macro working.