LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default PivotTable Source & Destination

I have a question about macros. I have a workbook which contains 50
worksheets; each worksheet contains historical price data for a single stock
(50 stocks=50 worksheets). I recorded my first ever macro to create a
PivotTable based on this data and saved it in the Personal Macro Workbook.
The goal is to have the macro create a PivotTable on Sheet1 using the data on
Sheet1, then go to Sheet2, create a PivotTable using the data on Sheet2, then
go to Sheet3, etc.

The macro works great until it gets ready to read the SourceData when trying
to create the PivotTable on Sheet2. This code generating an error:

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"Sheet1!R1C1:R170C4").CreatePivotTable TableDestination:= _
"'[Alcoa 90-04.xls]Sheet1'!R2C6", TableName:="PivotTable1", _
DefaultVersion:=xlPivotTableVersion10

I suspect the problem is that the SourceData and TableDestination refer to
Sheet1, when the goal is to read the data on Sheet2.

Is there any way to reference the data on Sheet1, then reference the data on
Sheet2, etc. all the way to Sheet50?

Thanks for your help,
Eric
 
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
Source and Destination Malcolm Excel Worksheet Functions 1 June 2nd 10 09:20 PM
Source and Destination worksheet difference Malcolm Excel Worksheet Functions 5 May 31st 10 12:16 AM
How can I insert a row in a source that links to a destination Bob Excel Worksheet Functions 1 December 12th 08 07:45 AM
Data Validation source = destination? andy62 Excel Worksheet Functions 7 December 4th 07 11:10 PM
PivotTable Source & Destination Tom Ogilvy Excel Programming 0 September 17th 04 08:43 PM


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