Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

Naming Charts

Dear Experts:

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

MyChart_01
MyChart_02
MyChart_03
etc.

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
0
AndreasHermle
Asked:
AndreasHermle
  • 2
  • 2
3 Solutions
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
Hello,

try

           .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
0
 
AndreasHermleAuthor Commented:
Hi teylyn,

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

Regards, Andreas
0
 
Rory ArchibaldCommented:
Would it not be:
 .Name = "MyChart_" & Format( i + 1, "00")
0
 
Rory ArchibaldCommented:
And just:
With myChtObj

Rather than:
With myChtObj.Chart.Parent  
0
 
AndreasHermleAuthor Commented:
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
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now