I tried to separate the boxes and the lines without result. The i is corrupt!
Sub HideShowLine2()
Application.ScreenUpdating = False
Dim i As Integer
For i = 1 To 7
Dim J As Integer
For J = 7 To 8
If ActiveSheet.CheckBoxes("Check Box " & J).Value = -4146 Then
ActiveSheet.ChartObjects("Grafiek 2").Activate
ActiveChart.SeriesCollection(i).Format.Line.Visible = msoFalse
Else
ActiveSheet.ChartObjects("Grafiek 2").Activate
ActiveChart.SeriesCollection(i).Format.Line.Visible = msoTrue
End If
Next i
Next J
End Sub
Sub AssignMacro()
Application.ScreenUpdating = False
Dim i As Integer
For i = 7 To 14
ActiveSheet.Shapes.Range(Array("Check Box " & i)).Select
Selection.OnAction = "HideShowLine2"
Next i
End Sub
I see the problem but i don't know how to solve it.
Box 1 to 7 has to trigger ActiveChart.SeriesCollection(i).Format.Line 1 to 7 of grafiek 1
Box 7 to 14 has to trigger ActiveChart.SeriesCollection(i).Format.Line 1 to 7 of grafiek 2
But i don't know how to change the second macro to setup the boxes like that.
I really like the feature because i can see witch line (flow) is causes the problem. Then i can disable the other lines and make a other chart visible to see what is causing the flow drop.
Bookmarks