Solved

Pivot table question

Posted on 2011-09-28
2
190 Views
Last Modified: 2012-06-27
I have 3 pivot tables.  How would I programmatically refresh all 3
pivot tables to where they refresh individually?  As in I want the 1st
one to finish refreshing before the 2nd begins to refresh, and I want
the 2nd one to finish refreshing before the 3rd one begins to refresh?


0
Comment
Question by:tkrpata
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
telyni19 earned 500 total points
ID: 36719452
Does something like the attached code not work for you? Refreshing each table in turn should do so sequentially. If need be, you could put in a wait statement in between each Refresh statement like this one:
Application.Wait (Now() + "00:00:02") 'Waits two seconds

This one statement will also refresh every pivot table in the workbook, but not with any manual control over order or timing:
ThisWorkbook.RefreshAll

Is there a particular reason they need to be spaced out?
With Application.Sheets("Pivot Tables")
.PivotTables("Pivot1").PivotCache.Refresh
.PivotTables("Pivot2").PivotCache.Refresh
.PivotTables("Pivot3").PivotCache.Refresh
End With

Open in new window

0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 36816650
When the Pivot Tables were created, do they all use the same data source?

When creating a second pivot table using the same data source as a previous pivot table there should have been a message asking if you wanted to use the same data source. By saying No to this message it increases file size, hence why it is offered.

However, if the tables are linked to the same data source, refreshing one table will refresh all of them at the same time. I suspect this is the behaviour that you are seeing here that you want to get away from.

I suspect to get round this you would have to reset the data source for each pivot to be independent.

If this is on a large data source, I am guessing that this behaviour is causing the user's computer to slow/freeze while refreshing pivots whereas if they were done individually it may not cause this.

Thanks
Rob H
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question