Refresh order when refreshing all in a workbook

M

Michael Pan

I created a workbook with two sheets. In sheet1 there is a table connecting
to an external data source (From Sql Server). Sheet2 has a pivot table of
which ithe data are bases on the table of sheet1.

Now when I click the refresh all button to refresh all objects in the
workbook, the order is refresh pivot table first, and then the table of
external data. So we have to refresh all again or refresh the pivot table
individually.

Is this a bug? Can we manually change the refresh order to refresh external
data first, then the pivot table based on it?
 
K

KC

One way could be to refresh the pivottable when you select the Sheet2. Right
click on worksheet tab (Sheet2) and click select code.
paste the below code

Option Explicit
Private Sub Worksheet_Activate()

Dim ptTemp As PivotTable

For Each ptTemp In Me.PivotTables
ptTemp.RefreshTable
Next ptTemp

End Sub



So whenever you open Sheet2, the pivottable date would be refreshed.

Regards,
-kc
*Click YES if this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top