Pivot table only updates via VBA when sheet is active

Glory

Well-known Member
Joined
Mar 16, 2011
Messages
640
Code:
With Sheet6
        
        .PivotTables("PivotTable2"). _
            PivotFields("Name").CurrentPage = "Text"
 
End With

This code is not working. If I change "Sheet6" to "ActiveSheet" and activate Sheet6, it works just fine.

I don't want to have to activate all the sheets that I'm going to be working with. Is there any way to fix this code?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
bump

Edit: You know, come to think of it, when I "PrintOut" the pivot reports I think that the sheets are being activated anyway, so maybe it doesn't really matter if I activate the sheets first and just do it that way.

If anybody has any input to offer on this that'd be great, but otherwise I guess I know what I'm gonna do.
 
Upvote 0
Hi Glory,

Your code worked perfectly for me - i havent faced any problem with something like this

Sheet1.Activate
With Sheet4

.PivotTables("PivotTable1"). _
PivotFields("Code").CurrentPage = "1"

End With

So, i dont know how to help you...

M.
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,879
Members
452,949
Latest member
Dupuhini

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