Chart Object

Mike_Col
04-01-2003, 10:23 PM
How can I identify a chart in VBA without the auto number Excel assigns to it? I want to add a chart and set the data range to a specific range. Everytime I run the Macro it does not recognize the chart due to the number it assigns to the chart.


Thanks,

Mike

Wamphyri
04-02-2003, 07:17 AM
You can also identify a chart by it's name.
Charts("sales")
rather than just
Charts(2)

Mike_Col
04-02-2003, 08:27 AM
You can also identify a chart by it's name.
Charts("sales")
rather than just
Charts(2)


How can I name the chart or find the name?


Thanks

Wamphyri
04-02-2003, 08:49 AM
If the chart is it's own sheet then the name is on the Tab with all the worksheets.

If the chart is an embedded chart you can use this will give you the name of every chart embedded in Sheet1.

Sub test()
For Each c In Sheet1.ChartObjects
MsgBox c.Name
Next
End Sub

BTW if it is an embedded chart then you use ChartObjects("Chart 1") rather then Charts("Chart 1") to identify it.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum