tetsujinbh
New Member
- Joined
- May 1, 2014
- Messages
- 2
Hi
I have a workbook with a lot of pivot tables. The workbook is also connected to an external database. Whenever I open the workbook, it automatically updates the data, but not the pivots. I know you can set the pivots up to refresh on opening, but it refreshes the pivots before it updates the data so it is pretty pointless. Refresh All does the same thing. So I just want to refresh the pivots and not the data, if that makes sense? I tried using code that people suggested on forums:
Is there a way to refresh just the pivots without the loop?
thanks.
I have a workbook with a lot of pivot tables. The workbook is also connected to an external database. Whenever I open the workbook, it automatically updates the data, but not the pivots. I know you can set the pivots up to refresh on opening, but it refreshes the pivots before it updates the data so it is pretty pointless. Refresh All does the same thing. So I just want to refresh the pivots and not the data, if that makes sense? I tried using code that people suggested on forums:
however, it just seems to loop continuously and I had to force excel to close in order to stop it.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
Is there a way to refresh just the pivots without the loop?
thanks.