ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   getting focus on an optionbutton (https://www.excelbanter.com/excel-programming/297013-getting-focus-optionbutton.html)

Len

getting focus on an optionbutton
 
I have a userform with three text boxes and nine
optionbuttons. The optionbuttons are in one group. When I
tab through the optionbuttons I want the focus to move
from one optionbutton to another and have the optionbutton
take focus (i.e. get the dot in the button). Tabbing
causes the caption on the optionbutton to be highlighted
but the option button actually does not get focus (i.e.
OptionButton1.Value = False). I want "OptionButton1.Value
= True" to occur when I tab to the optionbutton. How do I
get this to happen? Is this possible?


Harald Staff

getting focus on an optionbutton
 
Hi

Private Sub OptionButton1_Enter()
OptionButton1.Value = True
End Sub

Private Sub OptionButton2_Enter()
OptionButton2.Value = True
End Sub

HTH. Best wishes Harald

"Len" skrev i melding
...
I have a userform with three text boxes and nine
optionbuttons. The optionbuttons are in one group. When I
tab through the optionbuttons I want the focus to move
from one optionbutton to another and have the optionbutton
take focus (i.e. get the dot in the button). Tabbing
causes the caption on the optionbutton to be highlighted
but the option button actually does not get focus (i.e.
OptionButton1.Value = False). I want "OptionButton1.Value
= True" to occur when I tab to the optionbutton. How do I
get this to happen? Is this possible?




Tom Ogilvy

getting focus on an optionbutton
 
Harald showed you how to do what you requested, but just to clarify, getting
focus doesn't involve changing the value. the control has the focus when
you tab to it.

--
Regards,
Tom Ogilvy

"Len" wrote in message
...
I have a userform with three text boxes and nine
optionbuttons. The optionbuttons are in one group. When I
tab through the optionbuttons I want the focus to move
from one optionbutton to another and have the optionbutton
take focus (i.e. get the dot in the button). Tabbing
causes the caption on the optionbutton to be highlighted
but the option button actually does not get focus (i.e.
OptionButton1.Value = False). I want "OptionButton1.Value
= True" to occur when I tab to the optionbutton. How do I
get this to happen? Is this possible?




No Name

getting focus on an optionbutton
 
Yes, that works!!!

Thanks Harald Staff

Len
-----Original Message-----
Hi

Private Sub OptionButton1_Enter()
OptionButton1.Value = True
End Sub

Private Sub OptionButton2_Enter()
OptionButton2.Value = True
End Sub

HTH. Best wishes Harald

"Len" skrev i

melding
...
I have a userform with three text boxes and nine
optionbuttons. The optionbuttons are in one group. When

I
tab through the optionbuttons I want the focus to move
from one optionbutton to another and have the

optionbutton
take focus (i.e. get the dot in the button). Tabbing
causes the caption on the optionbutton to be highlighted
but the option button actually does not get focus (i.e.
OptionButton1.Value = False). I

want "OptionButton1.Value
= True" to occur when I tab to the optionbutton. How do

I
get this to happen? Is this possible?



.



All times are GMT +1. The time now is 10:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com