Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reset a chart's index number (Excel 2K, Off2KPro, Win2KPro)

    Err.. the title might be a little vague, but I'm not sure what to call the problem.

    Here it is, tho: on a worksheet, I create a chart and save it in the worksheet. In working with the chart object in VBA, it is referenced as ("Chart1"), for example:

    <font face="Georgia">ActiveSheet.ChartObjects("Chart 1").Activate</font face=georgia>

    Now, if I goof up and delete the chart -- start all over again on that worksheet, the 'new' chart is

    <font face="Georgia">ActiveSheet.ChartObjects("Chart 2").Activate</font face=georgia>

    For each re-do the chart number increments.

    How can I 'reset' Excel to get all the charts (one per worksheet!) to have the same index number? (I *am* being careful to have the specific worksheet activated so don't worry about some kind of name/index collision in the overall workbook. <img src=/S/yep.gif border=0 alt=yep width=15 height=15> )

  2. #2
    3 Star Lounger Jim Cone's Avatar
    Join Date
    Feb 2002
    Location
    Portland, Oregon, USA
    Posts
    238
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Reset a chart's index number (Excel 2K, Off2KPro, Win2KPro)

    Steve,

    How about using...

    ActiveSheet.ChartObjects(1).Chart.Activate

    Regards,
    Jim Cone
    San Francisco, CA

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Reset a chart's index number (Excel 2K, Off2KPro, Win2KPro)

    In addition to Jim's suggestion, you could also name the object (select the chart and enter the name in the namebox) then you can refer to it by name in code. If you delete the chart and create a new one, you can give it the same name and the code will still work as desired

    Steve

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reset a chart's index number (Excel 2K, Off2KPro, Win2KPro)

    thanks for the suggestion -- i'll try it tonight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •