Formerly Best Training
© 2024 STL. All Rights Reserved.
All prices offered for business users and exclude VAT. E&OE
2nd Floor, CA House, 1 Northey Street, Limehouse Basin, London, E14 8BT. United Kingdom
Forum home » Delegate support and help forum » Microsoft VBA Training and help » EXCEL Chart names
Resolved · Low Priority · Version 2007
Roger has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course
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
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 practiceIt 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 |
We'll call during UK business hours
Server loaded in 0.07 secs.