Using two sets of options buttons in Excel

udhay

New Member
Joined
Jul 27, 2011
Messages
1
Hi,

I have two sets of option buttons in my excel sheet. One set will have options captioned as "One", "Two" and "Three". By clicking any of these my excel sheet cell "D2" will contain a no. accordingly. Say, if I click the option "Two", my excell sheet "D2" will be filled with a value of "2".

Similarly, I have another set of option buttons in the same excel sheet that lists "Eight" and "Nine". When clicked "Eight", it will retun value "8" to another cell, say "E2".

I used the following VB program for that:


Sub obn_Click()
' for the first three options "One", "Two" and "Three"

Select Case ActiveSheet.OptionButtons(Application.Caller).Caption
Case "Zero": [D2].Value = 0
Case "One": [D2].Value = 1
Case "Two": [D2].Value = 2

End Select
End Sub


Sub OptionButton4_Click()
' for the two cases "Eight" and "Nine"


Select Case ActiveSheet.OptionButtons(Application.Caller).Caption
Case "Eight": [E2].Value = 8
Case "Nine": [E2].Value = 9


End Select
End Sub


Here come the questions.

In my excel sheet, first I select "One" from the first set ("One", Two" and "Three"). Thus, I get value 1 in "D2". Now, when I click "Eight" from the second set of options ("Eight" and "Nine"), the option "One" from first set is deselected and then "Eight" is selected. Consoling part is "D2" is still filled with 1 and "E2" is with 8. But I need one of the options in first set is still retained with the selected, when I choose from the second set.

Secondly, is it possible to use the program in a way to fill "D2" with word "One" instead of number "1", when clicked the option "One"?

Thanks for your help in advance,

Udhay :)
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You can create different groups of option buttons on the worksheet by using different GroupName properties for them.
Rightclick an optionbutton and select Properties. In there, choose a unique GroupName for each group of optionbuttons that you want to have behave as a unit.

For your second question, try this:
Case "One": [D2].Value = "One"
or am I missing something?
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,729
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top