You can't put each OptionButton IN a different Frame and get them to work as
a group, no matter what you assign to the GroupName property. All
OptionButtons within the **same** Frame operate as a group **independent**
from any other OptionButtons placed in different Frames (the word "Frame" is
meant to include the UserForm itself as well). If you want to use
OptionButtons to control things as you have described, then you will have to
move them outside of the Frames so they sit on the UserForm itself. You can
place them *near* their respective Frames, just not *on* them. If you choose
to do that, here is how to make them all work together properly.
First off, move the OptionButtons off the Frames and position them where you
want. Next, we will need a way to identify which controls are on which
Frame. We will do that using the Tag property to hold a common
identification string that we can check within our code. To do this, click
any control in Frame1 and then press Ctrl+A to select all the controls
within that Frame and then set the Tag property for the selected controls to
the name of the OptionButton you want to control them (for example, type
OptionButton1 into the Tag property for the selected controls if you are
using default names). Also, select the Frame itself and set its Tag property
to the name for the OptionButton too (it seems that Ctrl+A selects the
controls inside the Frame, but not the Frame itself). Now, repeat this
procedure for your other Frames (using the OptionButton name for the
controlling OptionButton in the Tag property for their respective controls).
Next, copy/paste this code into the UserForm's code window...
'************** START OF CODE **************
Private Sub UserForm_Initialize()
OptionButton1.Value = True
'
' Place rest of your UserForm_Initialize event code here
'
End Sub
Private Sub OptionButton1_Click()
EnableAndDisableControls OptionButton1
End Sub
Private Sub OptionButton2_Click()
EnableAndDisableControls OptionButton2
End Sub
Private Sub OptionButton3_Click()
EnableAndDisableControls OptionButton3
End Sub
Private Sub EnableAndDisableControls(OptButton As MSForms.OptionButton)
Dim C As Control
For Each C In Me.Controls
If Not TypeOf C Is MSForms.OptionButton Then
If C.Tag = OptButton.Name Then
C.Enabled = True
Else
C.Enabled = Not OptButton.Value
End If
End If
Next
End Sub
'************** END OF CODE **************
That is it. Run your UserForm and it should do what you want.
Rick