Per row, I have the name, the Y value and three sets of X values. For example:
Name, Y value, X value 1, X value 2, X value 3
Name, Y value, X value 1, X value 2, X value 3
Name, Y value, X value 1, X value 2, X value 3
(and so on..)
I am trying to plot each row onto an existing scatter graph (where each name has three sets of points) and then for it to step down to the next row and repeat the same process.
I have the code:
But it is coming up with the error message "Error 91: Object variable or With block variable not set"
I'm really new to vba so if this is completely wrong I apologise!
Name, Y value, X value 1, X value 2, X value 3
Name, Y value, X value 1, X value 2, X value 3
Name, Y value, X value 1, X value 2, X value 3
(and so on..)
I am trying to plot each row onto an existing scatter graph (where each name has three sets of points) and then for it to step down to the next row and repeat the same process.
I have the code:
Code:
Sub summaryGraph()
Worksheets("PE summary").ChartObjects(1).Activate
Do While Index < 200
Call MySummaryGraph(i)
ActiveCell.Offset(1, 0).Select
Loop
End Sub
Function MySummaryGraph(I)
With ActiveChart.SeriesCollection.NewSeriesSetsourceData
.Name = ActiveSheet.Range("AG3")
.Values = ActiveSheet.Range("AF3")
.XValues = ActiveSheet.Range("AJ3")
End With
With ActiveChart.SeriesCollection.NewSeries
.Name = ActiveSheet.Range("AG3")
.Values = ActiveSheet.Range("AF3")
.XValues = ActiveSheet.Range("AK3")
End With
With ActiveChart.SeriesCollection.NewSeries
.Name = ActiveSheet.Range("AG3")
.Values = ActiveSheet.Range("AF3")
.XValues = ActiveSheet.Range("AL3")
End With
End Function
But it is coming up with the error message "Error 91: Object variable or With block variable not set"
I'm really new to vba so if this is completely wrong I apologise!
Last edited by a moderator: