feeelix
feeelix

Reputation: 25

VBA: refreshing just one pivot table for each external data source

Okay so I have the following code to refresh all the pivot tables in the active workbook:

 For Each oSht In Active Workbook.Worksheets

    For Each oTab In oSht.PivotTables

      oTab.RefreshTable

    Next oTab

Next oSht

However, I feel that this is inefficient because, when you refresh a pivot, it automatically refreshes all other pivots connected to the same data table.

I would therefore like to refresh only one pivot table for each external data table i have in the active workbook but cant work out a way of implementing this...

Upvotes: 0

Views: 432

Answers (1)

MP24
MP24

Reputation: 3200

You can use the ThisWorkbook.PivotCaches collection and refresh the cache instead of each table.

Upvotes: 0

Related Questions