ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Navigating between option buttons is not selecting the option (https://www.excelbanter.com/excel-programming/330758-re-navigating-between-option-buttons-not-selecting-option.html)

drhalter

Navigating between option buttons is not selecting the option
 
Ramana,

I just thought of this. If you look at Excel's Insert Cells... dialog box,
you are forced to use arrow keys to navigate the option buttons. If you use
tab, it goes to Ok, Cancel, then back to the one option button that is true,
whichever that is. So I tried to emulate that. We'll use option buttons
opt1, op2, opt3 on userform1

Userform1_Initialize()
opt1.tabstop = true
opt2.tabstop = false
opt3.tabstop = false
End sub

opt1_change()
if opt1 = true then opt1.tabstop = true
if opt1 = false then opt1.tabstop = false
End sub

opt1_enter()
opt1 = true
End Sub

opt2_change()
if opt2 = true then opt2.tabstop = true
if opt2 = false then opt2.tabstop = false
End sub

opt2_enter()
opt2 = true
End Sub

opt3_change()
if opt3 = true then opt3.tabstop = true
if opt3 = false then opt3.tabstop = false
End sub

opt3_enter()
opt3 = true
End Sub

Use tab to enter the opt1, use the arrows to choose which opt you want, you
can then safely use tab to leave.

Dave

"Ramana" wrote:

Hi,
In my user form, while navigating between option buttons, the focus is
moving to the new option buttons but the new option is not getting selected
unless I press space bar.
Please see the attached excel file.

Any clue?

Advance Thanks,
Ramana




Ramana

Navigating between option buttons is not selecting the option
 
Hi Dave,
Thanks for your help. Your solution works fine.

Thanks,
Ramana

"drhalter" wrote in message
...
Ramana,

I just thought of this. If you look at Excel's Insert Cells... dialog

box,
you are forced to use arrow keys to navigate the option buttons. If you

use
tab, it goes to Ok, Cancel, then back to the one option button that is

true,
whichever that is. So I tried to emulate that. We'll use option buttons
opt1, op2, opt3 on userform1

Userform1_Initialize()
opt1.tabstop = true
opt2.tabstop = false
opt3.tabstop = false
End sub

opt1_change()
if opt1 = true then opt1.tabstop = true
if opt1 = false then opt1.tabstop = false
End sub

opt1_enter()
opt1 = true
End Sub

opt2_change()
if opt2 = true then opt2.tabstop = true
if opt2 = false then opt2.tabstop = false
End sub

opt2_enter()
opt2 = true
End Sub

opt3_change()
if opt3 = true then opt3.tabstop = true
if opt3 = false then opt3.tabstop = false
End sub

opt3_enter()
opt3 = true
End Sub

Use tab to enter the opt1, use the arrows to choose which opt you want,

you
can then safely use tab to leave.

Dave

"Ramana" wrote:

Hi,
In my user form, while navigating between option buttons, the focus is
moving to the new option buttons but the new option is not getting

selected
unless I press space bar.
Please see the attached excel file.

Any clue?

Advance Thanks,
Ramana







All times are GMT +1. The time now is 10:33 AM.

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