ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 2007 : Create a Chart (record macro) (https://www.excelbanter.com/excel-programming/422094-excel-2007-create-chart-record-macro.html)

mathieu

Excel 2007 : Create a Chart (record macro)
 
Hi there,

I am trying a very simple creation of a chart. I have recorded the
macro, then removed some lines and end up with (*). When I do
everything manually (when recording) everything works just fine, but
when reexecuting the macro, I get a fatal error (poorly translated
from french):

Execution Error 1004
Error defined by application or object.

When I click 'debug', the line points to:
ActiveSheet.Shapes.AddChart.Select

However it appears the syntax should be correct, ref:
http://msdn.microsoft.com/en-us/library/bb238877.aspx

Thank you !

(*)
Sub Macro2()
'
' Macro2 Macro
'

Range("D3,G3,J3,M3,P3,S3,V3,Y3,AB3,AE3,AH3,AK3").S elect
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range( _
"ROIs!$D$3;ROIs!$G$3;ROIs!$J$3;ROIs!$M$3;ROIs!$P$3 ;ROIs!$S
$3;ROIs!$V$3;ROIs!$Y$3;ROIs!$AB$3;ROIs!$AE$3;ROIs! $AH$3;ROIs!$AK$3" _
)
ActiveChart.ChartType = xlXYScatterSmooth
End Sub


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

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