Excel – Refreshing all the pivot tables in the excel workbook with a macro

excelrefreshvba

I have a workbook with 20 different pivot tables. Is there any easy way to find all the pivot tables and refresh them in VBA?

Best Answer

Yes.

ThisWorkbook.RefreshAll

Or, if your Excel version is old enough,

Dim Sheet as WorkSheet, Pivot as PivotTable
For Each Sheet in ThisWorkbook.WorkSheets
    For Each Pivot in Sheet.PivotTables
        Pivot.RefreshTable
        Pivot.Update
    Next
Next
Related Topic