I've got a user form designed as follows:
two option buttons grouped
combo box
two option buttons (grouped and activated when one of the options in the combo box is selected)
checkbox
I need to make sure that a user select all this options but the checkbox before clicking OK. The checkbox is selected by default but there are cases when I need to unselect it (but not a user).
I had a similar issue with option buttons on a spreadsheet and with a help from this community I've got the following code:
and
So I was thinking to repurpose it for the user form, but I've got different types of controls now and one of them (checkbox) should be excluded. So I wonder how I can do it.
two option buttons grouped
combo box
two option buttons (grouped and activated when one of the options in the combo box is selected)
checkbox
I need to make sure that a user select all this options but the checkbox before clicking OK. The checkbox is selected by default but there are cases when I need to unselect it (but not a user).
I had a similar issue with option buttons on a spreadsheet and with a help from this community I've got the following code:
VBA Code:
Function HasBeenSelected() As Boolean
Dim i As Long
For i = 1 To 2
HasBeenSelected = ActiveSheet.OptionButtons("Option Button " & Choose(i, 2, 4)).Value = xlOn
If HasBeenSelected Then Exit For
Next i
If Not HasBeenSelected Then MsgBox "Please Select the Tier", 48, "Selection Required"
End Function
and
VBA Code:
If Not HasBeenSelected Then Exit Sub
So I was thinking to repurpose it for the user form, but I've got different types of controls now and one of them (checkbox) should be excluded. So I wonder how I can do it.