Hi everyone,
I am not a pro programer and I am trying to plot a great amount of data and to place the resulting graphs organized at a new sheet. In order to do so, I am making a macro with a simpler data set (image attached). The final purpose is to skip some columns with variable column lengths. My idea was to produce a simple macro, even if it is not the most elegant way to do it. the code is:
and, when I compile it says that there is a "Compile Error: Argument not optional" right at the beginning and I do not get why...
Thank you for your time and help.
I am not a pro programer and I am trying to plot a great amount of data and to place the resulting graphs organized at a new sheet. In order to do so, I am making a macro with a simpler data set (image attached). The final purpose is to skip some columns with variable column lengths. My idea was to produce a simple macro, even if it is not the most elegant way to do it. the code is:
Code:
Public Sub chats()
Dim xaxis As Range
Dim yaxis As Range
Dim A As Characters
Dim B As Characters
Dim i As Integer
For i = 1 To 2
Dim c As Chart
Set c = ActiveWorkbook.charts.Add
Set c = c.Location(Where:=Cells(1, i * 6), Name:="Sheet2")
With c
.ChartType = xlXYScatterLines
End With
A = MsgBox.Cells(1, 2 * i - 1).Adress(RowAbsolute:=False, ColumnAbsolute:=False)
B = MsgBox.Cells(1, 2 * i).Adress(RowAbsolute:=False, ColumnAbsolute:=False)
xaxis = Range(A, Range(A).End(xlDown))
yaxis = Range(B, Range(B).End(xlDown))
Dim s As Series
Set s = c.SeriesCollection.NewSeries
With s
.Values = yaxis
.XValues = xaxis
End With
Next i
End Sub
Thank you for your time and help.
Last edited by a moderator: