Which way is better to refresh pivot tables

mark hansen

Well-known Member
Joined
Mar 6, 2006
Messages
534
Office Version
  1. 2016
Platform
  1. Windows
I've been looking around the interweb for way to use VBA to refresh pivot tables and discovered there is also a pivot cache refresh. I found the following, and was wondering is one way better (maybe faster) than the other...

Set WS = ActiveSheet
For Each PT In WS.PivotTables
PT.PivotCache.Refresh
Next PT

Or
Set WS = ActiveSheet
For Each PT In WS.PivotTables
PT.RefreshTable
Next PT


What is the difference in data quality and or speed?
Thanks,
Mark
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Neither one is "better." As with most things, it depends on what you're doing.

Multiple pivot tables may share the same cache if they are using the same data source, so updating the cache may affect multiple tables. Updating a table will update just that table. There may also be differences depending on whether you have selected the option to store the data with the workbook or not, but I have not explored this. But there is no difference in data quality, and I'm not even sure what you mean by that.

(Please use code tags around code.)
 
Upvote 0
Thanks... I think I need to look at one particular sheet that takes 7 seconds to finish all of the refreshing. All of the pivot tables and charts come from one table and there are 8 charts, and 13 tables and 9 slicers.

I appreciate you help.
Mark
 
Upvote 0

Forum statistics

Threads
1,214,973
Messages
6,122,534
Members
449,088
Latest member
RandomExceller01

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