ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Refresh order when refreshing all in a workbook (https://www.excelbanter.com/excel-discussion-misc-queries/242902-refresh-order-when-refreshing-all-workbook.html)

Michael Pan

Refresh order when refreshing all in a workbook
 
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?

KC

Refresh order when refreshing all in a workbook
 
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



"Michael Pan" wrote:

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?



All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com