Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 623
Default Creating multiple pivot tables from same cache

I have a macro which should create three pivot tables from the same source
data. I can manually create all three sans problem. However, when I execute
the code, I get the first two tables, but on the third table, Excel stops
with error 1004 on the following statement:

Set PT = PTCache.CreatePivotTable(TableDestination:="", _
TableName:="AssetLevels")

This is exactly the same statement which starts off the creation of the
second table (other than changing the TableName).

I'm using XL2002, but I need it to work in XL2000 as well.

What am I doing wrong?

--
Regards,
Fred
Please reply to newsgroup, not e-mail



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Creating multiple pivot tables from same cache

untested but it is probably the "destination" argument. If you leave it blank it will try to create a new sheet - once but if you do it multiple times it may be trying to overwrite the 2nd pivottable. Instead of leaving it blank, you could us

sheets.add after:=sheets(sheets.count

Set PT = PTCache.CreatePivotTable(TableDestination:=sheets( sheets.count).range("A1"),
TableName:="AssetLevels"

or similar
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 623
Default Creating multiple pivot tables from same cache

That was it!

For some reason, Excel will, when given a blank destination, create a first
pt, and a second pt, but won't create the third.

Oh well, live and learn.

--
Regards,
Fred
Please reply to newsgroup, not e-mail


"xlbo" wrote in message
...
untested but it is probably the "destination" argument. If you leave it

blank it will try to create a new sheet - once but if you do it multiple
times it may be trying to overwrite the 2nd pivottable. Instead of leaving
it blank, you could use

sheets.add after:=sheets(sheets.count)

Set PT =

PTCache.CreatePivotTable(TableDestination:=sheets( sheets.count).range("A1"),
_
TableName:="AssetLevels")

or similar



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
Creating Views within pivot tables Nick Anderson Excel Discussion (Misc queries) 3 November 19th 08 01:08 AM
creating a pivot table from 4 pivot tables phyllis W Excel Worksheet Functions 0 October 12th 08 09:52 PM
Creating Pivot Tables Andrew Excel Discussion (Misc queries) 0 January 31st 08 10:03 PM
Creating Pivot Tables using a CSV file Felippe Domingos Excel Discussion (Misc queries) 1 February 7th 07 10:33 PM
Pivot cache Kreed Excel Discussion (Misc queries) 0 November 14th 05 09:17 PM


All times are GMT +1. The time now is 01:14 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"