Selecting Chart Name with a macro


Posted by Ian Bartlett on August 08, 2001 2:49 AM

I have a macro that creates XY scatter charts. When the chart is created, Excel allocates a sequential number to the chart it has just created. So long as the chart is selected, the macro works.

When trying to reselect the chart, my macro fails. The macro has the number of the chart coded in (ie. Shapes("Chart 19") ), the next chart created is Chart 20 and the macro can't find the specified item.

Is it possible to either assign a name to the newly created chart, or to pick up the name (number) of the chart just created?

Many thanks,

Ian



Posted by mseyf on August 08, 2001 11:55 AM

Ian-

can you use:

ActiveSheet.ChartObjects.Count

to get the number of charts and use that number to select the last chart?

just a guess

Mark