Chart naming - vba

shodan

Active Member
Joined
Jul 6, 2005
Messages
486
Dear board members,

I have created a sheet with a chart, and than copied that chart again to use as a base and changed it afterwards.

However, I see now that both charts have the same name and I don't seem to be able to change this name. Anybody knows how I should do this. They are now both called chart 1.

I tried these two thing:

Selecting the chart and change the name in the place where you see its name (there where you see the defined ranges name)

and I also tried to use following code after selecting the chart:
'ActiveChart.Name = "Chart Plant"

Neither of them worked for me so I must be doing something wrong.

thanks for helping
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try like this

Code:
Sub NameChart()
ActiveSheet.ChartObjects(ActiveSheet.ChartObjects.Count).Name = "Chart Plant"
End Sub
 
Upvote 0
hey VOG

that did the trick. Thanks a lot. Now there is just one thing. The name had in there was the name for my first chart but it renamed my second chart. Not that is really a big deal but i can be confusing.

now i was trying to get it changed by this

Code:
ActiveWorkbook.Charts("Chart Plant").Name = "Chart_Bevs"

but this also doesnt work. what is wrong here than?
 
Upvote 0
Select the chart you want to rename, and run this:

ActiveChart.Parent.Name = "New Name"
 
Upvote 0

Forum statistics

Threads
1,224,579
Messages
6,179,656
Members
452,934
Latest member
mm1t1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top