Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2007 Pivot Tables - Updated Data Source

We have just upgraded from Excel 2002 to 2007 and have found that VBA
associated with pivot tables behaves differently.

In Excel 2002 all we needed to do was ...

Sheets("Rev").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh

N.B. The data source is refreshed daily and is constantly extending.

So in Excel 2007 we seem to need to 'manually' update the data source before
refreshing the pivot table.

So far I have failed to get anything to work fully.

Here's an extract of the code so far ...

Dim rgSource As Range

Windows("Data.xls").Activate
Sheets("RawData").Select
Range("C1").CurrentRegion.Select
Set rgSource = Selection
Windows("Pivot.xls").Activate
ActiveSheet.PivotTables("PivotTable1").ChangePivot Cache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, _
SourceData:=rgSource, _
Version:=xlPivotTableVersion10)

It all goes well up to the last statement !

So, essentially I want to update the data source in a pivot table. The
Pivot tale is in Pivot.xls and the data, which is updated daily, is in
Data.xls.

Anyone out there who can help me out?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Excel 2007 Pivot Tables - Updated Data Source

We now have a solution ... see "updating pivot table to include additional
rows" thread.

Happy to receive any suggestions on a more elegant solution !!

Thanks.

"TopRoper" wrote:

We have just upgraded from Excel 2002 to 2007 and have found that VBA
associated with pivot tables behaves differently.

In Excel 2002 all we needed to do was ...

Sheets("Rev").Select
ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh

N.B. The data source is refreshed daily and is constantly extending.

So in Excel 2007 we seem to need to 'manually' update the data source before
refreshing the pivot table.

So far I have failed to get anything to work fully.

Here's an extract of the code so far ...

Dim rgSource As Range

Windows("Data.xls").Activate
Sheets("RawData").Select
Range("C1").CurrentRegion.Select
Set rgSource = Selection
Windows("Pivot.xls").Activate
ActiveSheet.PivotTables("PivotTable1").ChangePivot Cache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, _
SourceData:=rgSource, _
Version:=xlPivotTableVersion10)

It all goes well up to the last statement !

So, essentially I want to update the data source in a pivot table. The
Pivot tale is in Pivot.xls and the data, which is updated daily, is in
Data.xls.

Anyone out there who can help me out?

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 - Editing the data source shared by multiple pivot ta sankat Excel Discussion (Misc queries) 1 April 22nd 10 03:05 PM
Data Source in Pivot Tables Pam Charts and Charting in Excel 5 September 26th 08 07:13 PM
Excel 2007 change pivot data source bdub Excel Discussion (Misc queries) 4 August 13th 07 07:54 PM
Source Data in Pivot Tables cqc Excel Worksheet Functions 7 August 2nd 07 01:34 PM
Pivot Table data source "data source contains no visible tables" Jane Excel Worksheet Functions 0 September 29th 05 08:28 PM


All times are GMT +1. The time now is 12:28 AM.

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

About Us

"It's about Microsoft Excel"