Naming Charts

Posted on 2011-04-25
Last Modified: 2012-05-11
Dear Experts:

below code snippet is supposed to name Charts in the following syntax:


The 'format'-part of the code is obviously not correct. How do I have change the code so that the charts are correctly named?

With myChtObj.Chart.Parent  
           .Name = Format("MyChart_" & i + 1, "_##")
End With
        i = i + 1

Help is much appreciated. Thank you very much in advance.

Regards,  Andreas
Question by:AndreasHermle
    LVL 50

    Assisted Solution



               .Name = "MyChart_" & Format( i + 1, "_##")

    I assume the i is part of a for/next loop? why do you then add a 1 to i? This would be a bit easier with more of your code. Can you post the whole for/next loop?

    cheers, teylyn

    Author Comment

    Hi teylyn,

    thank you very much for your swift support. I am off to lunch and will get back to you afterwards.

    Regards, Andreas
    LVL 85

    Accepted Solution

    Would it not be:
     .Name = "MyChart_" & Format( i + 1, "00")
    LVL 85

    Assisted Solution

    by:Rory Archibald
    And just:
    With myChtObj

    Rather than:
    With myChtObj.Chart.Parent  

    Author Closing Comment

    Hi Brad:

    ok, great, this works just fine. Thank you very much for your professional help.
    Teylyn, I am awarding 50 points to you since the syntax of the code snippet is correct. Thank you very much.

    Regards, Andreas

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
    Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
    This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
    This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now