Я бы включил все ваши функции в одну большую функцию, и функциональность разделилась бы блоком Select Case
.
Private Sub functionRouter(checkAction as integer)
Select Case checkAction
Case 1
'Code for function one
Case 2
'Code for function two
''Etc.
End Select
End Sub
Вам нужно будет перевернуть все ваши флажки. Это зависит от того, какой флажок вы используете.
Sub test()
Dim chkBox As CheckBox
Dim chkBox2 As OLEObject
'Regular
For Each chkBox In Sheets("Sheet1").CheckBoxes
Debug.Print chkBox.Caption
Next chkBox
'ActiveX
For Each chkBox2 In Sheets("Sheet1").OLEObjects
If TypeName(chkBox2.Object) = "CheckBox" Then
Debug.Print chkBox2.Object.Value
End If
Next chkBox2
You could do a few different things with all of your checkboxes. You could use the tag
property (you would need to set all of them, but this allows for duplicates). Then call functionRouter(chkBox.tag)
Or you could parse something from the name functionRouter Right(chkBox.name, 1)