Hello,
How can I select the optionbutton1 in my userform if the user hits the enter key. For instance the user will select either tab button or the arrow keys to go to specific optionbutton and then press enter to select that instead of using spacebar. However spacebar should still be an option to use.
I tried this code below but it will also select the optionbutton1 with using an arrow key. Can be annoying if I need to choose between more than 2 option buttons.
Will appreciate a lot and thanks in advance.
How can I select the optionbutton1 in my userform if the user hits the enter key. For instance the user will select either tab button or the arrow keys to go to specific optionbutton and then press enter to select that instead of using spacebar. However spacebar should still be an option to use.
I tried this code below but it will also select the optionbutton1 with using an arrow key. Can be annoying if I need to choose between more than 2 option buttons.
VBA Code:
Private Sub OptionButton1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then OptionButton1 = True
End Sub
Will appreciate a lot and thanks in advance.