excel chart names

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

TrustPilot

starstarstarstarstar Excellent

  • Home
  • Courses
  • Promotions
  • Schedule
  • Formats
  • Our Clients

Forum home » Delegate support and help forum » Microsoft VBA Training and help » EXCEL Chart names

EXCEL Chart names

resolvedResolved · Low Priority · Version 2007

Roger has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course

EXCEL Chart names

I want to manipulate some charts in VBA.
As far as I can tell, EXCEL names the charts "chart1", chart2" etc. If I have several charts in a spreadsheet, how can I find out the number that EXCEL has given it?

Thanks

Roger

RE: EXCEL Chart names

Hi Roger, the quickest way to do this is to select the chart and use:

MsgBox ActiveChart.Name

Think about looping through the collection of charts in a workbook testing for a particular chart name and manipulating accordingly.

Hope this helps,

Anthony


 

VBA tip:

Good coding practice

It is important that you always comment the VBA code that you write. By doing this it will make the code much easier to read, as both yourself and other people will be able to see what the code is doing or meant to be doing. This is very important if there is more than one person who writes code in the company as you may have different styles of coding and may not really understand what the other person is trying to do. Also if you write some code and then do not touch it for a year or so you may actually forget what it is meant to be doing. so it is very important to include comments throughout your code and try and make sure that they are as useful as possible

View all VBA hints and tips


Server loaded in 0.07 secs.