Second question. The bars in the chart can not be checked or unchecked. Because of the macro is referring to lines. What is the command for the bars?
I have 2 charts in one sheet. Therefor i made unother macro
Sub HideShowLineGrafiek2()
Application.ScreenUpdating = False
Dim i As Integer
For i = 8 To 14
If ActiveSheet.CheckBoxes("Check Box " & i).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
End Sub
Sub AssignMacro()
Application.ScreenUpdating = False
Dim i As Integer
For i = 8 To 14
ActiveSheet.Shapes.Range(Array("Check Box " & i)).Select
Selection.OnAction = "HideShowLineGrafiek2"
Next i
End Sub
As you van see the same except de i are different. But when i unchecked or check a box i got a error that
ActiveChart.SeriesCollection(i).Format.Line.Visible = msoTrue is a invalid parameter
Bookmarks