ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I name charts in Excel 2000? (https://www.excelbanter.com/excel-discussion-misc-queries/24720-how-do-i-name-charts-excel-2000-a.html)

SimSmall

How do I name charts in Excel 2000?
 
Hi all,

I'm doing some IT coursework and have a macro that creates a chart from some
data in a worksheet. All works well until you run the macro again - now it
says the chart doesn't exist... I've sinced looked at it in visual basic, the
highlighted line says to select "Chart 22" my guess is that every time I run
this macro it gets bigger by one, but even so, it now has the wrong name, and
the macro crashes :'(

Anyone know how I can set each newly created chart to be called "Chart 22"
or whatever else I tell it to look for?
Please? ;)

Bob Umlas

If you're always referring to the last chart created, you can use something
like
set Mychart = activesheet.chartobjects(activesheet.chartobjects. count)

Bob Umlas
Excel MVP

I'm leading a FREE 1-hour online Webinar on Excel Tips & Tricks.
May 12 from 4-5PM, and again June 15, 4-5PM.
If interested, go to http://www.iil.com, click on the yellow/orange
"Try a free webinar" link on the left side, click the Microsoft Excel
Tips & Tricks link, follow instructions to register.


"SimSmall" wrote in message
...
Hi all,

I'm doing some IT coursework and have a macro that creates a chart from

some
data in a worksheet. All works well until you run the macro again - now it
says the chart doesn't exist... I've sinced looked at it in visual basic,

the
highlighted line says to select "Chart 22" my guess is that every time I

run
this macro it gets bigger by one, but even so, it now has the wrong name,

and
the macro crashes :'(

Anyone know how I can set each newly created chart to be called "Chart 22"
or whatever else I tell it to look for?
Please? ;)




Debra Dalgleish

Jon Peltier has some sample code for creating charts. It may help you
adjust your own code:

http://www.peltiertech.com/Excel/Cha...kChartVBA.html

SimSmall wrote:
Hi all,

I'm doing some IT coursework and have a macro that creates a chart from some
data in a worksheet. All works well until you run the macro again - now it
says the chart doesn't exist... I've sinced looked at it in visual basic, the
highlighted line says to select "Chart 22" my guess is that every time I run
this macro it gets bigger by one, but even so, it now has the wrong name, and
the macro crashes :'(

Anyone know how I can set each newly created chart to be called "Chart 22"
or whatever else I tell it to look for?
Please? ;)



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



All times are GMT +1. The time now is 02:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com