Embedded Charts & Macros?

K

Ken

Excel 2000 ... I have 50+ Macros assigned to buttons for
printing various TabSheets & embedded charts. The issue
is the embedded charts ... they are not all the same
name ... Some are "Chart 1" ... Some are "Chart
2" ... "Chart 3" etc etc ... As a result the Macro fails
until I adjust the # of the Chart within the recorded
Macro.

What I would like to do is to rename all the embedded
charts to "Chart 1" ... Note: there is only 1 embedded
chart on a TabSheet.

How do I achieve this? Thanks ... Kha
 
D

Debra Dalgleish

The following code will rename all the charts to Chart 1:

'==========================
Sub NameCharts()
On Error Resume Next
Dim ws As Worksheet
Dim ch As ChartObject
For Each ws In ActiveWorkbook.Worksheets
For Each ch In ws.ChartObjects
ch.Name = "Chart 1"
Next ch
Next ws
End Sub
'=========================
 
K

Ken

-----Original Message-----
The following code will rename all the charts to Chart 1:

'==========================
Sub NameCharts()
On Error Resume Next
Dim ws As Worksheet
Dim ch As ChartObject
For Each ws In ActiveWorkbook.Worksheets
For Each ch In ws.ChartObjects
ch.Name = "Chart 1"
Next ch
Next ws
End Sub
'=========================



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top