How to use hide the specific line in graph by using check box?

aas123321

New Member
Joined
Apr 6, 2020
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
I have a graph that contains ten line, I created a group of ten check boxs. How can I hide specific line by he specific check boxes.?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Here is my VBA code, cannot run


Sub HideShowLine()
Application.ScreenUpdating = False
Dim i As Integer
For i = 1 To 5
If ActiveSheet.CheckBoxes("Check Box " & i).Value = -4146 Then
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(i).Format.Line.Visible = msoFalse
Else
ActiveSheet.ChartObjects("Chart 1").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 = 1 To 5
ActiveSheet.Shapes.Range(Array("Check Box " & i)).Select
Selection.OnAction = "HideShowLine"
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,565
Messages
6,114,338
Members
448,569
Latest member
Honeymonster123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top