Refreshing pivot table from different worksheet

M

mandles1

Hi,
I'm hoping someone can help me out with refreshing a pivot table from a
different worksheet than the one it is in.
I have the following code as part of my macro:

Application.Worksheets("PivotTable-contracts").Activate
ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh


I also have 2 other worksheets, "PivotTable-products" and
"PivotTable-prices" which I would like to refresh when the same macro
is run. These however are not part of the active worksheet, so how do I
have these two pivot tables refresh by calling them from a different
worksheet?
I've tried a couple things, like:


Worksheets("PivotTable-products").PivotTables("PivotTable4").PivotCache.Refresh

which doesn't seem to work.

Any suggestions would be greatly appreciate!
Thanks- Mandy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top