I am looping through data to plot trends. I plot the first trend but I get an error at the 2nd. It says: Error 1004 unable to set values property of series class.
What could be the issue?
Please help.
What could be the issue?
Please help.
Code:
For i = 0 To 6
Set y02error(i) = SheetY02.Range(Cells(33 + 35 * i, 4 + 14 * j), Cells(42 + 35 * i, 4))
Set y02setp(i) = SheetY02.Range(Cells(33 + 35 * i, 8), Cells(42 + 35 * i, 8))
Next i
'add chart'
Charts.Add
If SheetY02.Name = "Y02A" Then
ActiveChart.Name = m(j) & "-A"
ElseIf SheetY02.Name = "Y02B" Then
ActiveChart.Name = m(j) & "-A"
End If
ActiveChart.ChartType = xlXYScatterLines
'specifying the series for charting'
For i = 0 To 6
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i + 1).XValues = y02setp(i)
ActiveChart.SeriesCollection(i + 1).Values = y02error(i)
ActiveChart.SeriesCollection(i + 1).Name = SheetY02.Cells(10 + 35 * i, 1)
Next i