Hi
i have 4 checkboxs in a userform, but only 1 may be selected.
Wrote some code but it does not work.
any ideas ?
Bernie
Sub Validate()
'Check if more then 1 shift has been ticked
tick1 = 0
tick2 = 0
tick3 = 0
tick4 = 0
checkshift = 0
If CheckBox1.Value = True Then
tick1 = 1
ElseIf CheckBox2.Value = True Then
tick2 = 1
ElseIf CheckBox3.Value = True Then
tick3 = 1
ElseIf CheckBox4.Value = True Then
tick4 = 1
End If
checkshift = tick1 + tick2 + tick3 + tick4
If checkshift >= 1 Then
resp = MsgBox("ONLY 1 SHIFT CAN BE SELECTED", "PLEASE NOTE")
End If
End Sub
i have 4 checkboxs in a userform, but only 1 may be selected.
Wrote some code but it does not work.
any ideas ?
Bernie
Sub Validate()
'Check if more then 1 shift has been ticked
tick1 = 0
tick2 = 0
tick3 = 0
tick4 = 0
checkshift = 0
If CheckBox1.Value = True Then
tick1 = 1
ElseIf CheckBox2.Value = True Then
tick2 = 1
ElseIf CheckBox3.Value = True Then
tick3 = 1
ElseIf CheckBox4.Value = True Then
tick4 = 1
End If
checkshift = tick1 + tick2 + tick3 + tick4
If checkshift >= 1 Then
resp = MsgBox("ONLY 1 SHIFT CAN BE SELECTED", "PLEASE NOTE")
End If
End Sub