ysommer
Programmer
- Feb 26, 2001
- 45
Hi, I am trying to build a routine that will track each chart in a workbook and put it into a multi dimensional array that will have for each chart its name and its location.
This is the code:
For i = 1 To Worksheets.Count - 1
Worksheets(i).Select
For Each objChart In ActiveSheet.ChartObjects
intChartCount = intChartCount + 1
ReDim Preserve ChartArray (intChartCount, 1)
ChartArray(intChartCount, 0) = objChart.Name
ChartArray(intChartCount, 1) = Worksheets(i).Name
Next objChart
Next i
For Each cht In Charts
intChartCount = intChartCount + 1
ReDim Preserve ChartArray(intChartCount, 1)
ChartArray(intChartCount, 0) = cht.Name
ChartArray(intChartCount, 1) = cht.Name
Next cht
I am all the rime getting an error msg "subscript out of range" on the redim preserve line in the second time it reaches it.
Any ideas?
Thanks,
Yoel
This is the code:
For i = 1 To Worksheets.Count - 1
Worksheets(i).Select
For Each objChart In ActiveSheet.ChartObjects
intChartCount = intChartCount + 1
ReDim Preserve ChartArray (intChartCount, 1)
ChartArray(intChartCount, 0) = objChart.Name
ChartArray(intChartCount, 1) = Worksheets(i).Name
Next objChart
Next i
For Each cht In Charts
intChartCount = intChartCount + 1
ReDim Preserve ChartArray(intChartCount, 1)
ChartArray(intChartCount, 0) = cht.Name
ChartArray(intChartCount, 1) = cht.Name
Next cht
I am all the rime getting an error msg "subscript out of range" on the redim preserve line in the second time it reaches it.
Any ideas?
Thanks,
Yoel