#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Chart Name

I have an embedded chart on a worksheet. Each time I run my macro, I
delete the existing chart and create it fresh. I would like for its
name to remain Chart 1, but Excel renames it each time it is created,
to something like "Sheet 1 Chart 22". I'm not sure this makes much
difference, but I am curious as to Excel's "memory" of the deleted
charts, and will I run into trouble when I get to chart names like
Sheet 1 Chart 280309387. (Excel 2002)
Thanks, James

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Chart Name

activesheet.OleObjects(1).Chart.Name = "Chart 1"

--
Regards,
Tom Ogilvy


"Zone" wrote:

I have an embedded chart on a worksheet. Each time I run my macro, I
delete the existing chart and create it fresh. I would like for its
name to remain Chart 1, but Excel renames it each time it is created,
to something like "Sheet 1 Chart 22". I'm not sure this makes much
difference, but I am curious as to Excel's "memory" of the deleted
charts, and will I run into trouble when I get to chart names like
Sheet 1 Chart 280309387. (Excel 2002)
Thanks, James


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Chart Name

The sheet's 'object-counter' increments by one each time you insert any type
of object. The new default name is "object-type object-counter'.

AFAIK the only way to reset the counter is to delete all objects from the
sheet, save and close the file.

I've never had a problem even with the counter over a million, but not
tested to 280 million as it seems you intend to reach!

There might be a potential problem if creating new a object in VBA when the
counter reaches 65536 and in the same code .Select the object even if
there's only one object on the sheet (not sure why). But it's rarely
necessary to select anything in code.

Instead of deleting the chartobject each time why not update its chart.

Regards,
Peter T


"Zone" wrote in message
oups.com...
I have an embedded chart on a worksheet. Each time I run my macro, I
delete the existing chart and create it fresh. I would like for its
name to remain Chart 1, but Excel renames it each time it is created,
to something like "Sheet 1 Chart 22". I'm not sure this makes much
difference, but I am curious as to Excel's "memory" of the deleted
charts, and will I run into trouble when I get to chart names like
Sheet 1 Chart 280309387. (Excel 2002)
Thanks, James



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Chart Name


Thanks, Tom and Peter.
James

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to change position of chart labels on line chart Shane Henderson[_2_] Charts and Charting in Excel 1 May 27th 11 09:31 AM
Change Chart Properties for Multiple Chart Shts using a Worksheet KUMPFfrog Charts and Charting in Excel 0 July 22nd 09 11:01 PM
Excel 2003 is missing Built-In Custom Chart Types in Chart Wizard Julius Charts and Charting in Excel 2 March 6th 09 04:43 PM
Excel 2003 is missing Built-In Custom Chart Types in Chart Wizard Julius Setting up and Configuration of Excel 1 March 6th 09 01:57 AM
Excel 2003: How to nudge a chart element or shape on a chart? Ted M H Charts and Charting in Excel 5 June 30th 08 07:08 PM


All times are GMT +1. The time now is 11:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"