Adding new series for each row of data to a stacked column chart using a loop
I am trying to add new series for each new row of data that I enter I want
the name of the series to be in column B and the values to be in columns E
to AH. The counter to loop from 71-206 and the j variables accounts for
the title and other offsets so I am matching the series to its data.
Any help would be greatly appreciated. Thanks!
Sub stacked()
'
' stacked Macro
'
Dim i As Integer
Dim j As Integer
For i = 71 To 206
ActiveChart.SeriesCollection.NewSeries
j = i + 5
ActiveChart.SeriesCollection(i).Name = "=Sheet1!B" & j
ActiveChart.SeriesCollection(i).Values = "=Sheet1!E:AH" & j ":AH"&j
Next i
End Sub
No comments:
Post a Comment