Rename an embedded chart in Excel 2002

R

Richard Newman

Is there an easy way of renaming a chart object (i.e. an
embedded chart) in Excel 2002? I mean so that if you
access the .Name property of the Chart or ChartObject in
VBA code it will have changed. I've ended up having to
write a macro to do this!
 
D

Debra Dalgleish

You can name the chart programmatically:

'=========================
Sub AddChartObject()
Dim chObj As ChartObject
Dim rng As Range
Set rng = Sheets("Sheet1").Range("ChartData")
'
Set chObj = ActiveSheet.ChartObjects.Add _
(Left:=100, Width:=400, Top:=100, Height:=250)
chObj.Chart.ChartType = xlXYScatterLines
chObj.Chart.SetSourceData _
Source:=Sheets("Sheet1").Range("A1:G6")
chObj.Name = "RegionData"

End Sub
'==============================

or manually:
1. Hold the Ctrl key, and click on the chart to select it
2. Click in the Name box, to the left of the formula bar
3. Type a name for the chart
4. Press Enter
 

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