ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   This has to be easy. (https://www.excelbanter.com/charts-charting-excel/202682-has-easy.html)

PK

This has to be easy.
 
I need to create a BLANK chart using VBA and rename it.
I am using Charts.Add

The problem i keep running into is that when i create a new chart, it
increments chart1 then chart2, etc... even if i rename the new chart

I am creating a module to be used in MSAccess to automate excel, so i will
not have the luxury of knowing what the new chart name will be.

It would be great if i could do something like

VariableNewChartName = Charts.Add
Sheets(VariableNewChartName ).Name = VariableMyNewName



or something like that




PK

This has to be easy.
 
Got it:

Dim Chrt As Chart

Set Chrt = Charts.Add
With Chrt
.Name = "freddykruger"
End With




"PK" wrote:

I need to create a BLANK chart using VBA and rename it.
I am using Charts.Add

The problem i keep running into is that when i create a new chart, it
increments chart1 then chart2, etc... even if i rename the new chart

I am creating a module to be used in MSAccess to automate excel, so i will
not have the luxury of knowing what the new chart name will be.

It would be great if i could do something like

VariableNewChartName = Charts.Add
Sheets(VariableNewChartName ).Name = VariableMyNewName



or something like that




Jon Peltier

This has to be easy.
 
Or simply:

Charts.Add.Name = "My New Chart"

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"PK" wrote in message
...
Got it:

Dim Chrt As Chart

Set Chrt = Charts.Add
With Chrt
.Name = "freddykruger"
End With




"PK" wrote:

I need to create a BLANK chart using VBA and rename it.
I am using Charts.Add

The problem i keep running into is that when i create a new chart, it
increments chart1 then chart2, etc... even if i rename the new chart

I am creating a module to be used in MSAccess to automate excel, so i
will
not have the luxury of knowing what the new chart name will be.

It would be great if i could do something like

VariableNewChartName = Charts.Add
Sheets(VariableNewChartName ).Name = VariableMyNewName



or something like that







All times are GMT +1. The time now is 02:00 PM.

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