Embedded Optionbuttons

T

Todd Huttenstine

Hey

I have 3 option buttons. Heres how I want them to work
together. I want Optionbutton1 to have 2 other
optionbuttons under it(Optionbutton2 and Optionbutton3).
I want those 2 optionbuttons to be associated with each
other to where when I click on Optionbutton1 I have the
option to click on Optionbutton2 and Optionbutton3. If I
click on Optionbutton2 then I still want Optionbutton1 to
be bulleted but not optionbutton3, and if I click on
Optionbutton3, I want Optionbutton2 to NOT be bulleted but
Optionbutton1 to still be bulleted.

How do I do this?
Right now my problem is they are all connected.

Thanks
Todd Huttenstine
 
T

Tushar Mehta

Create a frame. Put two option buttons in it. Call these buttons 1
and 4. Make sure they are sufficiently spaced apart.

Nest a second frame just below the first option button and completely
*within* the first frame. Put 2 option buttons in this frame. Call
them buttons 2 and 3.

Now, when you select one of the first 2 option buttons (1 or 4) XL/VBA
will toggle between those two. The same applies to the nested buttons
which will operate as an either-or pair. To enable the nested pair
only when button 1 is selected you will need code.

Option Explicit

Sub setNestedState()
With Me
.OptionButton2.Enabled = .OptionButton1.Value
.OptionButton3.Enabled = .OptionButton1.Value
End With

End Sub
Private Sub OptionButton1_Click()
setNestedState
End Sub

Private Sub OptionButton4_Click()
setNestedState
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top