G
garnote
Hi all,
I have a Sub for construct graphic but
if the number of vx is too large, ERROR
at .Values = Y. Why ?
Thank you for your help,
Serge
Sub ConstruireGraphiqueParTableauxVBA()
Dim X() As Double
Dim Y() As Double, i As Long, vx As Double
ReDim X(i), Y(i)
Application.ScreenUpdating = False
ici = ActiveSheet.Name
'*********************************************
For vx = -15 To 15
'If the number of vx is too large, ERROR
'at .Values = Y. Why ?
'*********************************************
X(i) = vx
Y(i) = vx ^ 2
i = i + 1
ReDim Preserve X(i), Y(i)
Next vx
Charts.Add
With ActiveChart
.ChartType = xlXYScatter
.Location Where:=xlLocationAsObject, Name:=ici
End With
Set ns = ActiveChart.SeriesCollection.NewSeries
With ns
.XValues = X
.Values = Y
End With
Application.ScreenUpdating = True
End Sub
I have a Sub for construct graphic but
if the number of vx is too large, ERROR
at .Values = Y. Why ?
Thank you for your help,
Serge
Sub ConstruireGraphiqueParTableauxVBA()
Dim X() As Double
Dim Y() As Double, i As Long, vx As Double
ReDim X(i), Y(i)
Application.ScreenUpdating = False
ici = ActiveSheet.Name
'*********************************************
For vx = -15 To 15
'If the number of vx is too large, ERROR
'at .Values = Y. Why ?
'*********************************************
X(i) = vx
Y(i) = vx ^ 2
i = i + 1
ReDim Preserve X(i), Y(i)
Next vx
Charts.Add
With ActiveChart
.ChartType = xlXYScatter
.Location Where:=xlLocationAsObject, Name:=ici
End With
Set ns = ActiveChart.SeriesCollection.NewSeries
With ns
.XValues = X
.Values = Y
End With
Application.ScreenUpdating = True
End Sub