Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Source and Destination | Excel Worksheet Functions | |||
Source and Destination worksheet difference | Excel Worksheet Functions | |||
How can I insert a row in a source that links to a destination | Excel Worksheet Functions | |||
Data Validation source = destination? | Excel Worksheet Functions | |||
PivotTable Source & Destination | Excel Programming |