Change a chart name to the sheet tab name?

RickM

Board Regular
Joined
Dec 5, 2007
Messages
84
I have approx 60 sheet tab each with a chart for each branch in the company. Is it possible to name the charts to equal the sheet tab? There is also a cell that contains the branch number in A33 on each sheet. I could use that reference as well.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi Rick,

I have beeen playing around with this macro:
It requires that there is only one chart per sheet and each sheet has a chart.
Please try it on a document copy.

Code:
Sub ChartRename()
 
Dim ws As Worksheet
 
For Each ws In ThisWorkbook.Worksheets
ws.Activate
ActiveSheet.ChartObjects.Select
N = ActiveSheet.ChartObjects.Count
ChrtName = ActiveSheet.ChartObjects(N).Name
ActiveSheet.ChartObjects(ChrtName).Name = ws.Name
 
Next
End Sub
 
Upvote 0
Thanks. There are other sheets in the wb and a few have multiple charts. The majority of the wb has one chart on each sheet. Is it possible to modify the code to exclude sheet9,7 and 21?
 
Upvote 0
I ran the code and it renamed the charts as needed then on the sheet without a chart it crashed..... as expected. I then just fixed a couple of chart names...... ALL IS WELL.....
THANKS ---- problem solved.
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,546
Members
449,038
Latest member
Guest1337

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