Results 1 to 4 of 4

Thread: Renaming Charts/chart objects??
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Jan 2010
    Posts
    121
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Renaming Charts/chart objects??

    I've got a chart embedded in a spreadsheet that is called 'Chart 1'.

    I've got some code to run and set the trendline which seems to run ok.

    Code:
    Dim STPChart As Chart
    
    Set STPChart = Worksheets("Detector1_Report").ChartObjects("Chart 1").Chart
    
    With STPChart
        blah blah blah...
    However, I don't really like having charts called 'Chart 1' as I find it more difficult for other people to decipher the code. If I change the chart object using
    Code:
    ActiveChart.Parent.Name = "STP"
    it fails on the first line above with RTE '-2147024809 (80070057): This member can only be accessed for a chart object.'

    [Note, I also change the 'Chart 1' to 'STP' in the problematic line.]

    Is there some other way I ought to rename the chart? Trying directly from excel doesn't work for me (Excel 2010).

  2. #2
    MrExcel MVP
    Moderator
    RoryA's Avatar
    Join Date
    May 2008
    Location
    UK
    Posts
    33,604
    Post Thanks / Like
    Mentioned
    47 Post(s)
    Tagged
    6 Thread(s)

    Default Re: Renaming Charts/chart objects??

    Select the chart, then on the Layout tab in the Chart Tools group, rename it using the box on the right hand side.

  3. #3
    Board Regular
    Join Date
    Jan 2010
    Posts
    121
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Renaming Charts/chart objects??

    I swear I tried that earlier and the name wouldn't stick, but it seems to now.

    Nonetheless I still get that error with
    Code:
    Set STPChart = Worksheets("Detector1_Report").ChartObjects("STP").Chart

  4. #4
    MrExcel MVP
    Moderator
    RoryA's Avatar
    Join Date
    May 2008
    Location
    UK
    Posts
    33,604
    Post Thanks / Like
    Mentioned
    47 Post(s)
    Tagged
    6 Thread(s)

    Default Re: Renaming Charts/chart objects??

    I don't know what to say - it works for me.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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