Hi All,
I have a UserForm with 16 Radio Buttons (8 groups of "Yes" Or "No"). (They Are Named OptionButton1,2,3,4,5,etc.)
I have a submit button - CommandButton1
I am trying to disable the "Submit" button until at least one button from each of the 8 groups are clicked. If each group has a button checked then I want the Submit Button to be enabled and display a message ("Thank you for completing")
Currently when I open the userform none of the buttons are checked and the submit button is disabled which is perfect, but when I click on at least one button from each group, the button is still disabled.
Below is my code. I'm not sure why the button is not enabling when requirement is met. Thank you for your help!
Private Sub UserForm_Initialize()
If OptionButton1.Value = False And OptionButton2.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton3.Value = False And OptionButton4.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton5.Value = False And OptionButton6.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton7.Value = False And OptionButton8.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton9.Value = False And OptionButton10.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton11.Value = False And OptionButton12.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton13.Value = False And OptionButton14.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton15.Value = False And OptionButton16.Value = False Then
CommandButton1.Enabled = False
Else
CommandButton1.Enabled = True
End If
End Sub
I have a UserForm with 16 Radio Buttons (8 groups of "Yes" Or "No"). (They Are Named OptionButton1,2,3,4,5,etc.)
I have a submit button - CommandButton1
I am trying to disable the "Submit" button until at least one button from each of the 8 groups are clicked. If each group has a button checked then I want the Submit Button to be enabled and display a message ("Thank you for completing")
Currently when I open the userform none of the buttons are checked and the submit button is disabled which is perfect, but when I click on at least one button from each group, the button is still disabled.
Below is my code. I'm not sure why the button is not enabling when requirement is met. Thank you for your help!
Private Sub UserForm_Initialize()
If OptionButton1.Value = False And OptionButton2.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton3.Value = False And OptionButton4.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton5.Value = False And OptionButton6.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton7.Value = False And OptionButton8.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton9.Value = False And OptionButton10.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton11.Value = False And OptionButton12.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton13.Value = False And OptionButton14.Value = False Then
CommandButton1.Enabled = False
ElseIf OptionButton15.Value = False And OptionButton16.Value = False Then
CommandButton1.Enabled = False
Else
CommandButton1.Enabled = True
End If
End Sub