<form action="https://www.reddit.com/r/excel/comments/5h19fx/using_msotrue_in_vba_to_change_series_marker/#" class="usertext warn-on-unload" id="form-t3_5h19fxqoc" style="margin: 0px; padding: 0px; font-size: small;">I have an Excel 2016 project I am working on and have need of a check box to toggle the visibility of a data series on a chart. The code I have included below works fine to hide the data series when I uncheck the box, but when I check the box again, the fill is not restored. Is there any way that I can affect this through the checkbox interface?
<code style="font-family: 'Courier New', courier, monospace; margin: 0px 2px; padding: 15px; border: 0px; border-radius: 2px; word-break: normal; display: block; font-size: 1em; line-height: 16px; overflow: auto; background-color: transparent;">Sub CheckBox17_Click()
Dim boxvalue As Long
boxvalue = Worksheets("Test View").Shapes("Check Box 17").ControlFormat.Value
If boxvalue = 1 Then
Worksheets("Test View").ChartObjects("Chart 2").Chart.FullSeriesCollection(2).Select
Selection.Format.Fill.Visible = msoTrue
Else
Worksheets("Test View").ChartObjects("Chart 2").Chart.FullSeriesCollection(2).Select
Selection.Format.Fill.Visible = msoFalse
End If
End Sub
</code>
</form>
Thanks for any insight you might have guys.
<code style="font-family: 'Courier New', courier, monospace; margin: 0px 2px; padding: 15px; border: 0px; border-radius: 2px; word-break: normal; display: block; font-size: 1em; line-height: 16px; overflow: auto; background-color: transparent;">Sub CheckBox17_Click()
Dim boxvalue As Long
boxvalue = Worksheets("Test View").Shapes("Check Box 17").ControlFormat.Value
If boxvalue = 1 Then
Worksheets("Test View").ChartObjects("Chart 2").Chart.FullSeriesCollection(2).Select
Selection.Format.Fill.Visible = msoTrue
Else
Worksheets("Test View").ChartObjects("Chart 2").Chart.FullSeriesCollection(2).Select
Selection.Format.Fill.Visible = msoFalse
End If
End Sub
</code>
</form>
Thanks for any insight you might have guys.