gibbo1715
09-03-2005, 01:37 PM
Im spending a lot of time lately trying (As i know i should) to make my code as simple and re usable as possible and with that im mind would like to know if the following idea is possible in VBA
Private Sub CommandButton1.Click()
Dim i As Integer
For i = 1 To 5
If UserForm1.Controls("Checkbox" & i) = True Then
call CheckBoxMacro_i '<<<<< Where i = Number
End If
Next i
End Sub
Private Sub CheckBoxMacro_1()
MsgBox "Hello1"
End Sub
Private Sub CheckBoxMacro_2()
MsgBox "Hello2"
End Sub
'Etc............
Cheers
Gibbo
Private Sub CommandButton1.Click()
Dim i As Integer
For i = 1 To 5
If UserForm1.Controls("Checkbox" & i) = True Then
call CheckBoxMacro_i '<<<<< Where i = Number
End If
Next i
End Sub
Private Sub CheckBoxMacro_1()
MsgBox "Hello1"
End Sub
Private Sub CheckBoxMacro_2()
MsgBox "Hello2"
End Sub
'Etc............
Cheers
Gibbo