Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Refresh External Data Then All Pivot Tables Based On It

I have a External Data Range on a worksheet ("Sheet1") named "Table1".
I have a Pivot Table on worksheet "Sheet2" named "PivotTable1" and it
was created using the External Data Range "Table1" on "Sheet1". I have
another Pivot Table on "Sheet3" named "PivotTable2" and it was created
using the data from "PivotTable1".

Here's my problem: I want to write a macro that refreshes all three;
the External Data Range and the two Pivot Tables. I tried using
"ActiveWorkbook.RefreshAll", however this apparently refreshes all
three simultaneously. Because "PivotTable1" is based on the External
Data Range, and it's being refreshed at the same time as the External
Data Range, no changes appear in the Pivot Tables.

I guess what I'm looking for is a way to tell Excel to first refresh
the External Data Range "Table1", then to wait until the entire refresh
is complete before refreshing "PivotTable1". Apparently because
"PivotTable2" is based on "PivotTable1", it will automatically be
refreshed when "PivotTable1" is.

Any help would be greatly appreciated.

Thanks,

Dave Brandes


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Refresh External Data Then All Pivot Tables Based On It

Worksheets("Sheet1").QueryTables(1).Refresh Backgroundquery:=False
Worksheets("Sheet2").PivotTables("PivotTable1").Re freshTable

However, your problem is probably that the QueryTable has the
backgroundquery option set to True - if you change it to False for all
querytables, then the Refreshall will probably work.

--
Regards,
Tom Ogilvy

"Dave" wrote in message
oups.com...
I have a External Data Range on a worksheet ("Sheet1") named "Table1".
I have a Pivot Table on worksheet "Sheet2" named "PivotTable1" and it
was created using the External Data Range "Table1" on "Sheet1". I have
another Pivot Table on "Sheet3" named "PivotTable2" and it was created
using the data from "PivotTable1".

Here's my problem: I want to write a macro that refreshes all three;
the External Data Range and the two Pivot Tables. I tried using
"ActiveWorkbook.RefreshAll", however this apparently refreshes all
three simultaneously. Because "PivotTable1" is based on the External
Data Range, and it's being refreshed at the same time as the External
Data Range, no changes appear in the Pivot Tables.

I guess what I'm looking for is a way to tell Excel to first refresh
the External Data Range "Table1", then to wait until the entire refresh
is complete before refreshing "PivotTable1". Apparently because
"PivotTable2" is based on "PivotTable1", it will automatically be
refreshed when "PivotTable1" is.

Any help would be greatly appreciated.

Thanks,

Dave Brandes




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot tables and replacing data, then refresh it Michael B[_2_] Excel Discussion (Misc queries) 1 January 8th 09 06:40 PM
How can I refresh data in pivot tables lcoated in separate tab DavidG Excel Discussion (Misc queries) 0 August 17th 07 01:54 AM
Pivot column disappears after external data refresh Fabio Missana Excel Worksheet Functions 0 August 22nd 06 03:11 PM
Pivot Tables - Missing Data after refresh Gr8Day Excel Worksheet Functions 0 July 7th 06 02:55 PM
Pivot table won't refresh after external data update on open Aaron Excel Programming 0 October 28th 04 02:51 PM


All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"