ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ActiveChart.ADD Fails (https://www.excelbanter.com/excel-programming/310846-activechart-add-fails.html)

Sean McPoland[_6_]

ActiveChart.ADD Fails
 
I have recorded a macro to add a new chart sheet but when
running the macro is step mode it fails:

the statements are
Charts.Add
ActiveChart.ChartType = xlSurface

and I get

Runtime error '1004'
method Charttype of object _chart failed...

any ideas - this is bog standard code

regards
Sean


Andy Pope

ActiveChart.ADD Fails
 
Hi Sean,

The reason it fails is there is not enough data in the chart to change
it to a surface chart.
Try adding data to your chart before changing the chart type.

Try to change the chart, that is created by the Charts.Add command,
manually and you will see an explanation.

Cheers
Andy


Sean McPoland wrote:

I have recorded a macro to add a new chart sheet but when
running the macro is step mode it fails:

the statements are
Charts.Add
ActiveChart.ChartType = xlSurface

and I get

Runtime error '1004'
method Charttype of object _chart failed...

any ideas - this is bog standard code

regards
Sean


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

Sean McPoland[_3_]

ActiveChart.ADD Fails
 
Hi Andy and thanks,

so what your really saying is that the Macro recorder is
at fault in that is does not order the statements in the
correct manner for creating a chart.

ie Add chart
add Series Data
then change charttype.....

Bujjer - who would have guessed that the macro recorder
would have got it so wrong......

Thanks again, will try it out later
regards
Sean





-----Original Message-----
Hi Sean,

The reason it fails is there is not enough data in the

chart to change
it to a surface chart.
Try adding data to your chart before changing the chart

type.

Try to change the chart, that is created by the

Charts.Add command,
manually and you will see an explanation.

Cheers
Andy


Sean McPoland wrote:

I have recorded a macro to add a new chart sheet but

when
running the macro is step mode it fails:

the statements are
Charts.Add
ActiveChart.ChartType = xlSurface

and I get

Runtime error '1004'
method Charttype of object _chart failed...

any ideas - this is bog standard code

regards
Sean


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
.


Jon Peltier[_8_]

ActiveChart.ADD Fails
 
Anything that the macro recorder spits out has to be used with care. There are a few things like
this that it puts lines in the wrong order. Also remember that it records you while you do
things, and working with a mouse and selecting everything before working on it is very inefficient.

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

Sean McPoland wrote:

Hi Andy and thanks,

so what your really saying is that the Macro recorder is
at fault in that is does not order the statements in the
correct manner for creating a chart.

ie Add chart
add Series Data
then change charttype.....

Bujjer - who would have guessed that the macro recorder
would have got it so wrong......

Thanks again, will try it out later
regards
Sean






-----Original Message-----
Hi Sean,

The reason it fails is there is not enough data in the


chart to change

it to a surface chart.
Try adding data to your chart before changing the chart


type.

Try to change the chart, that is created by the


Charts.Add command,

manually and you will see an explanation.

Cheers
Andy


Sean McPoland wrote:


I have recorded a macro to add a new chart sheet but


when

running the macro is step mode it fails:

the statements are
Charts.Add
ActiveChart.ChartType = xlSurface

and I get

Runtime error '1004'
method Charttype of object _chart failed...

any ideas - this is bog standard code

regards
Sean


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
.




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

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