Pivot table refresh

matts12

New Member
Joined
Mar 21, 2023
Messages
18
Office Version
  1. 2021
Platform
  1. Windows
Ok, so I have 4 data tables on separate sheets and I have their respective pivot tables on separate sheets also. Now I am using macros to switch to the sheets that contain the pivot tables. And within these macros I have a line of code that refreshes the pivot tables when switching to them which makes sense. However I am experiencing some bad lag when doing so and am wondering if there is a line of code that I could use that would ONLY update the pivot table if there is a change in data in the data table. It's annoying when a user is just looking at reports and has to wait every time for the pivot table sheets to refresh. And overall it makes my workbook look bad. Any help would be appreciated. Thanks.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi,
You have not posted your code ...

Do not use RefreshAll ...
but
VBA Code:
Sheet1.PivotTables("PivotTable1").Refreshtable
 
Upvote 0
Solution
Ok I have RefreshAll at the moment, do you think that's where the lag comes from? BTW I'm new on here, I am still figuring out how to post the code the way everyone else does it
 
Upvote 0
A couple of remarks ...

1. Remove RefreshAll and test the suggested instruction ...

2. In the tiny above your answer, you should see a choice of icons such as XLS and VBA ... the VBA one does insert the code tags you need ;)
 
Upvote 0
I get subscript out of range error
VBA Code:
sheets("Grain Sales Reports").PivotTables("Grain Sales Reports").RefreshTable
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,207
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top