This is my VBA code to create a scatter plot in Excel:
Sub createmychart()
Dim Chart1 As Chart
Set Chart1 = Charts.Add
With Chart1
.SetSourceData Source:=Sheets("usd_download data").Range("A2:B26001")
.ChartType = xlXYScatter
End With
End Sub
However, it ended up like this:
But I would like to have a graph like this:
I tried a lots but cannot figure out how to do this.
.ChartType
before.SetSourceData
might help Excel parse the data into X and Y columns. – Flopeared