Thread: ChartObjects
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy Patrick Molloy is offline
external usenet poster
 
Posts: 1,049
Default ChartObjects



works for me, I have a DIM for I too ...

Sub ShowMessage()
Dim ChartName(12) As String
Dim i As Long
ChartName(0) = "Chart 1"
i = 0
ActiveSheet.ChartObjects(ChartName(i)).Activate

End Sub


try
?ActiveSheet.ChartObjects(1).Name
in the immediate window to check that "1020" is correct - i assume so since
you said so, but safe to check



"Scooter" wrote in message
...
Why does this work

ActiveSheet.ChartObjects("1020").Activate

but this doesnt

Dim ChartName(12) As String
ChartName(0) = "1020"
I = 0
ActiveSheet.ChartObjects(ChartName(I)).Activate