Pivottable in another sheet is affected when the activesheet is refreshed

dandelion

New Member
Joined
Jul 16, 2022
Messages
33
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi,

I have 02 worksheets and in each worksheets I have 02 pivottable that are linked to the same source (datatable). In each worksheet, I have a code to have different format in terms of rows, columns... However, when I run the macro in worksheet 1 , the format of worksheet 1 is as expected then I run the macro in worksheet 2, the format of worksheet 2 is as expected however when I come back worksheet 1, the format is totally back to "unformated". How can I stop this?

I tried to use this:
in WS1: ActiveSheet.PivotTables("Main").RefreshTable
in WS2: ActiveSheet.PivotTables("Sub").RefreshTable
I named 02 pivots with the name "Main" and "Sub", respectively

to differeniate 02 pivots and only refresh in that Sheet only; however, it does not work.
Thanks for support!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
You might have 2 separate issues.
Firstly when you Refresh a Table you refresh the Pivot Cache and every Table using that Pivot Cache gets refreshed.

Assuming the tables are using the same cache, try going into one of the Pivot tables changing the Data Source so it doesn't inlude all the rows or column, refresh it and then change it back to the include all the rows and columns.
This doesn't always work but start with that.
If you know how to use the Immediate window in VBA (ctrl+G if it is not visible), you could put the below in that window and see if the number increases by one after you make the change. (include the ? at the start of the line)
VBA Code:
? ActiveWorkbook.PivotCaches.Count
 
Upvote 0
Solution

Forum statistics

Threads
1,214,999
Messages
6,122,645
Members
449,093
Latest member
Ahmad123098

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