I am trying to trying to run an excel database query and refresh pivot tables afterwards as they use the data from the query.
I am currently manually refreshing the main sheet with the query.
The code I have to refresh the pivot tables is as follows and this works correctly
Sheet2.PivotTables("PivotTable2").RefreshTable
Sheet2.PivotTables("PivotTable4").RefreshTable
I need the VBA code to refresh the external database query and I need to ensure that this has completed before refreshing the pivot tables.
Any suggestions, would be appreciated
thanks.
Bookmarks