Howdy, my code asks for a user to input (not shown in code below) an initial row and column (R1, C1) and final row and column (R2, C2) for the data I want to graph.
The data will all share the same XValues and differ in their Y-values. At least that's what I want to happen. I can't get past the seriescollection.XValules at all and I couldn't find the solution I was looking for online, so hopefully you can help!
The data will all share the same XValues and differ in their Y-values. At least that's what I want to happen. I can't get past the seriescollection.XValules at all and I couldn't find the solution I was looking for online, so hopefully you can help!
Code:
Dim R1, R2, C1, C2, i, x As Integer
Dim sh As Worksheet
Dim chrt As Chart
Set sh = ActiveWorkbook.Worksheets("Sheet2")
Set chrt = sh.Shapes.AddChart.Chart
i = 1
With chrt
.ChartType = xlXYScatter
For x = R1 To R2
.SeriesCollection.NewSeries[INDENT=2]' what am I doing wrong here?[/INDENT]
.SeriesCollection(i).XValues = _
sh.Range(Cells(R1 - 1, C1), Cells(R1 - 1, C2 - 1)).Select
.SeriesCollection(i).Values = _
sh.Range(Cells(x, C1), Cells(x, C2 - 1)).Select
i = i + 1
Next x
End With