UserForm Option button select using keyboard

jjlafond

Board Regular
Joined
Jul 17, 2014
Messages
56
Hello,

I created a UserForm with 3 option buttons, and it works fine. When The UserForm is called, the box pops up, and I can click on the buttons and continue.

What I would like to do is select the option button by keyboard instead. I can tab through each option, but the tab seems to highlight the text, not the bubble, and pressing enter does not fill the bubble.

Any ideas on how to select the bubble using the keyboard?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Suppose you've 3 option buttons


Alt + D will "tick" Option Button 1
Alt + S will tick option Button 2
Alt + A will tick option button 3


Code:
Private Sub UserForm_Initialize()


    Me.OptionButton1.Accelerator = "D"
    Me.OptionButton2.Accelerator = "S"
    Me.OptionButton3.Accelerator = "A"


End Sub
 
Upvote 0
Correct me if I'm wrong, but it's possible to create subs() for clicking on the label next to the option buttons. Could I set up a Me.OptionButton1.Accelerator of some sort to tick a button when enter is pressed on each corresponding label?

I'm just trying to simplify things a bit, and remove the Alt+ step now, being picky.
 
Upvote 0
Thank you, Space worked perfectly!

Just for the sake of learning Excel, would it still be possible to use something like Me.OptionButton1.Accelerator as a sub for the bubble label, or even just "On Enter(or any key), OptionBuutton1=TRUE" to make that work with any key?
 
Upvote 0

Forum statistics

Threads
1,223,157
Messages
6,170,419
Members
452,325
Latest member
BlahQz

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