#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Pivot Cache

Hi. I currently have a program that creates a pivot table. I want to create
another pivot table that keys off of the same data, but would like to use the
"cached" data rather than re-use the same data. I have the second pivot
table command below. How would I rewrite this to reference the cached data?
Thanks, Mike.

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"RAWData!A1:AE" & lastRow).CreatePivotTable TableDestination:="",
TableName:= _
"PivotTable4", DefaultVersion:=xlPivotTableVersion10
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Pivot Cache

Instead of adding a pivotcache in the code, create a pivot table from an
existing pivotcache, e.g.:

Dim pc As PivotCache
Dim ws As Worksheet
Dim pt As PivotTable

Set ws = Worksheets.Add
Set pc = Worksheets("Pivot").PivotTables(1).PivotCache
Set pt = pc.CreatePivotTable(TableDestination:=ws.Range("B3 "), _
TableName:="SalesPivot")

With pt
.AddFields RowFields:="Region"
.PivotFields("Units").Orientation = xlDataField
End With



Mike D. wrote:
Hi. I currently have a program that creates a pivot table. I want to create
another pivot table that keys off of the same data, but would like to use the
"cached" data rather than re-use the same data. I have the second pivot
table command below. How would I rewrite this to reference the cached data?
Thanks, Mike.

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"RAWData!A1:AE" & lastRow).CreatePivotTable TableDestination:="",
TableName:= _
"PivotTable4", DefaultVersion:=xlPivotTableVersion10



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

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
How to Clear a Pivot Table Cache DoctorG Excel Discussion (Misc queries) 1 February 16th 10 03:04 PM
reading pivot cache witek Excel Programming 1 July 10th 06 07:59 PM
Pivot Cache - Massive Spreadsheet Wyvern Excel Discussion (Misc queries) 3 March 3rd 06 12:38 AM
Pivot cache Kreed Excel Discussion (Misc queries) 0 November 14th 05 09:17 PM
Pivot Cache Memory Jared Excel Programming 0 December 16th 04 04:31 PM


All times are GMT +1. The time now is 11:05 PM.

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"