Please attempt the next option. Assuming you utilise form check boxes, you must enter 1 for the name of the check box that ends in 30, 2 for the name that ends in 31, and so on.
Sub CheckBoxesLoopHandling()
Dim sh As Worksheet, chkB As CheckBox, ext As Long
Dim Graph_1(1 To 2, 1 To 1), Graph_2(1 To 2, 1 To 1)
Dim Graph_3(1 To 3, 1 To 1), Graph_4(1 To 6, 1 To 1) 'array with a column...
Set sh = ActiveSheet
For Each chkB In sh.CheckBoxes
ext = Split(chkB.name)(2)
If ext >= 30 And ext <= 50 And chkB.Value = 1 Then
Graph_1(1, 1) = ext - 29
Graph_1(2, 1) = ext - 29
Graph_2(1, 1) = ext - 29
Graph_2(2, 1) = ext - 29
Graph_3(1, 1) = ext - 29
Graph_3(2, 1) = ext - 29
Graph_3(3, 1) = ext - 29
Graph_4(1, 1) = ext - 29
Graph_4(2, 1) = ext - 29
Graph_4(3, 1) = ext - 29
Graph_4(4, 1) = ext - 29
Graph_4(5, 1) = ext - 29
Graph_4(6, 1) = ext - 29
End If
Next
End Sub
or
Sub CheckBoxesLoopHandling()
Dim sh As Worksheet, chkB As CheckBox, ext As Long
Dim Graph_1(1 To 2, 1 To 21), Graph_2(1 To 2, 1 To 21)
Dim Graph_3(1 To 3, 1 To 21), Graph_4(1 To 6, 1 To 21)
Set sh = ActiveSheet
For Each chkB In sh.CheckBoxes
ext = Split(chkB.name)(2)
If ext >= 30 And ext <= 50 And chkB.Value = 1 Then
Graph_1(1, ext - 29) = 1
Graph_1(2, ext - 29) = 1
Graph_2(1, ext - 29) = 1
Graph_2(2, ext - 29) = 1
Graph_3(1, ext - 29) = 1
Graph_3(2, ext - 29) = 1
Graph_3(3, ext - 29) = 1
Graph_4(1, ext - 29) = 1
Graph_4(2, ext - 29) = 1
Graph_4(3, ext - 29) = 1
Graph_4(4, ext - 29) = 1
Graph_4(5, ext - 29) = 1
Graph_4(6, ext - 29) = 1
End If
Next
End Sub
To place 1 in the corresponding array columns...