lundi 14 janvier 2019

implementing checkbox to hide and show which lines in excel chart

I am trying to write a macro to assign to check boxes which I can then toggle on and off to show certain lines in my excel chart.

However when I try use the macro recorder for this it does not work.

So far the code I have tried is:
Sub Macro1()    
    ActiveSheet.ChartObjects("Chart 1").Activate
    ActiveChart.FullSeriesCollection(2).Format.Line.Visible = _
        Not ActiveChart.FullSeriesCollection(2).Format.Line.Visible
End Sub

The problem with this however is it keeps my legend entry even if the line is blank?

my current layout

Any help would be appreciated thanks.




Aucun commentaire:

Enregistrer un commentaire