Background : I have 2 excel sheets:
- Contains pivot tables and a Macro "Refresh"
- Data from SQL server
Macro contains VBA code for refreshing data and updating pivot tables automatically. The data is updated every night. The following is the VBA code:
Sub Refresh()
ActiveWorkBook.RefreshAll
End Sub
Problem:
When I run my Macro for first time, it takes 5min to execute and my pivot table is not updated with new data.
When I run it for second time, it executes perfectly.
I want my Macro to execute perfectly on first run.
Any help is greatly appreciated.
Note: This is my first post so please tolerate my edit.
sql server
then on second click it refreshes the pivot cache. – user42995