ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   change the name of the chart as it appears on the Chart Window (https://www.excelbanter.com/excel-programming/368250-change-name-chart-appears-chart-window.html)

Farooq Sheri

change the name of the chart as it appears on the Chart Window
 
I have a workbook that has code for combobox which when executed generates a
chart on one of the sheets. Each time this code is run the chart name, as it
appears on the Chart Window, changes. I want to rename this to "Chart 1". As
a general question what is difference between ChartObject and Charts?

Thanks and regards
Farooq Sheri

Tom Ogilvy

change the name of the chart as it appears on the Chart Window
 
a ChartObject is a container for a chart when it is hosted on a worksheet.
When a chart is on a Chartsheet, there is no ChartObject.

Activesheet.ChartObjects(1).Chart.Name = "Chart 1"

--
Regards,
Tom Ogilvy


"Farooq Sheri" wrote:

I have a workbook that has code for combobox which when executed generates a
chart on one of the sheets. Each time this code is run the chart name, as it
appears on the Chart Window, changes. I want to rename this to "Chart 1". As
a general question what is difference between ChartObject and Charts?

Thanks and regards
Farooq Sheri


Farooq Sheri

change the name of the chart as it appears on the Chart Window
 
thanks for the reply but I am getting "object does not support this property
or method" error

Farooq

"Tom Ogilvy" wrote:

a ChartObject is a container for a chart when it is hosted on a worksheet.
When a chart is on a Chartsheet, there is no ChartObject.

Activesheet.ChartObjects(1).Chart.Name = "Chart 1"

--
Regards,
Tom Ogilvy


"Farooq Sheri" wrote:

I have a workbook that has code for combobox which when executed generates a
chart on one of the sheets. Each time this code is run the chart name, as it
appears on the Chart Window, changes. I want to rename this to "Chart 1". As
a general question what is difference between ChartObject and Charts?

Thanks and regards
Farooq Sheri


Tom Ogilvy

change the name of the chart as it appears on the Chart Window
 
Activesheet.ChartObjects(1).Name = "Chart 1"

is probably what you want.

there is, however, also a chart name:

? Activesheet.ChartObjects(1).Chart.Name
Sheet1 Chart 1

--
Regards,
Tom Ogilvy


"Farooq Sheri" wrote:

thanks for the reply but I am getting "object does not support this property
or method" error

Farooq

"Tom Ogilvy" wrote:

a ChartObject is a container for a chart when it is hosted on a worksheet.
When a chart is on a Chartsheet, there is no ChartObject.

Activesheet.ChartObjects(1).Chart.Name = "Chart 1"

--
Regards,
Tom Ogilvy


"Farooq Sheri" wrote:

I have a workbook that has code for combobox which when executed generates a
chart on one of the sheets. Each time this code is run the chart name, as it
appears on the Chart Window, changes. I want to rename this to "Chart 1". As
a general question what is difference between ChartObject and Charts?

Thanks and regards
Farooq Sheri



All times are GMT +1. The time now is 04:17 PM.

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