Do you want to select all the chart sheets? Try this:
ActiveWorkbook.Charts.Select
To select only some of them, you need to select an array of chart names:
ActiveWorkbook.Charts(Array("Chart1", "Chart2")).Select
I retooled your macro slightly and it worked fine (your original one did
not, and ten seconds of deep thought couldn't shed any light).
Sub macro2()
Dim x As Long
Dim chrts() As String
ReDim chrts(1 To ActiveWorkbook.Charts.Count)
For x = 1 To ActiveWorkbook.Charts.Count
chrts(x) = ActiveWorkbook.Charts(x).Name
Next x
ActiveWorkbook.Charts(chrts).Select
End Sub
- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______
mrmac wrote:
I am trying to programmatically copy x number of charts
from one workbook to another. I have tried replicating a
recorded macro, using a string to represent the names of
the tabs in the workbook. It comes up with "Subscript Out
of Range" error. What's the right way to do this?
Sub macro1()
chrts = Chr(34)
For x = 1 To Charts.Count
chrts = chrts & Charts(x).Name & Chr(34) & Chr(44) & Chr
(32) & Chr(34)
Next x
chrts = Left(chrts, Len(chrts) - 3)
Sheets(Array(chrts)).Select
End Sub
Thanks for any help