For embedded charts you are better off naming the container that
contains the chart. Using the GUI, hold down SHIFT and click on a
chart. You will see that circles framing the selected object (which
happens to be called a chartobject).
Next, check the contents of the Name Box (extreme left of the formula
bar. If all the charts have default names it will contain something
like Chart n where n is a number. Click in the Name Box, enter your
desired name and complete the naming process with the ENTER key.
You can now refer to the chart in VBA as {sheet-reference}.ChartObjects
({name-used-above}).Chart
To do the same in VBA when you create a chart, it would depend on how
you created the chart and what, if any, variable you've used in the
process. I always use a variable that refers to the chart. So, I
would use aChart.Parent.Name="My name for the chartobject"
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article , t_marsh@---take-
this-out-to-reply---atcentre.co.uk says...
Hi,
Could someone tell me if its possible to give a chart a name (with or
without VBA) so that it can be referenced in VBA (I've searched but found no
reference to this topic)... if naming is not possible how would i go about
referring to specific charts in vba (there are several charts on one
worksheet, so i cannot just refer to the worksheet).
Thanks people,
Tim