Rename an embedded chart in Excel 2002

  • Thread starter Thread starter Richard Newman
  • Start date Start date
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!
 
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
 
Back
Top