Solved

Pivot table question

Posted on 2011-09-28
2
188 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

Technology Partners: 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

Suggested Solutions

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

735 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