M
mathieu
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").Select
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
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").Select
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