ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assign name to chart object? (https://www.excelbanter.com/excel-programming/375412-assign-name-chart-object.html)

[email protected]

Assign name to chart object?
 
Is it possible to assign a name to a chart?

Here's how I create the chart (the code makes the chart to fit in a
designated range of cells):


ActiveSheet.ChartObjects.Add(ChartLocation.Left,
ChartLocation.Top, ChartLocation.Width, ChartLocation.Height).Select
ActiveChart.SeriesCollection.Add Source:=ChartXValues

When I look at the ActiveChart.Name property, it is the Worksheet name
+ " Chart 1" (ex. "MyWorksheet Chart 1"). I can't figure out how to
assign a new name to the chart. Is the .name propery read-only for
charts?

Thanks.


Peter T

Assign name to chart object?
 
Name the ChartObject, not the ChartObject.Chart.

Activechart.Parent.name = "myChart" ' if a worksheet chart
Activechart.Chartobjects(1).Name = "myChart"

manually - hold Ctrl and select the chart, type a name in the box left of
input-bar

Regards,
Peter T

wrote in message
oups.com...
Is it possible to assign a name to a chart?

Here's how I create the chart (the code makes the chart to fit in a
designated range of cells):


ActiveSheet.ChartObjects.Add(ChartLocation.Left,
ChartLocation.Top, ChartLocation.Width, ChartLocation.Height).Select
ActiveChart.SeriesCollection.Add Source:=ChartXValues

When I look at the ActiveChart.Name property, it is the Worksheet name
+ " Chart 1" (ex. "MyWorksheet Chart 1"). I can't figure out how to
assign a new name to the chart. Is the .name propery read-only for
charts?

Thanks.





All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com