I want to add series to a graph based on whether a checkbox next to the series is checked. There are 11 possible graphs to add, and the data is found in range W148:AC158. Here is what I have so far:
I am not having much luck so far, any ideas? Thanks.
Code:
ActiveSheet.ChartObjects("Chart 6").Activate
Dim n
With ActiveChart
n = 8
For i = .SeriesCollection.Count To 11 Step 1
If Sheets("Inputs").OLEObjects("CheckBox" & i).Object.Value = True Then
.SeriesCollection.NewSeries
.SeriesCollection(i).Name = Worksheets("Inputs").Range("W14" & n).Text
.SeriesCollection(i).XValues = Worksheets("Inputs").Range("AB14" & n & ":AC14" & n).Value
.SeriesCollection(i).Values = Worksheets("Inputs").Range("Z14" & n & ":$AA$14" & n).Value
n = n + 1
Next i
End With
I am not having much luck so far, any ideas? Thanks.