ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command button auto select after pressing Enter (https://www.excelbanter.com/excel-programming/370949-command-button-auto-select-after-pressing-enter.html)

Bafa[_12_]

Command button auto select after pressing Enter
 

I have a user form with 5 text boxes to fill in and 3 command buttons
Command1 button that needs to be pressed for a function and the
Commend2 labeled "Next" command2 labeled "Back". When I fill in th
first text box and press Enter it automaticly places my curser in th
next text box, and so on. After I fill in the last text box it the
auto selects the Command1 button which perfoms a function for the user
But it does not go ahead to command2 button, which would take them t
the next page when pressed or hutting Enter. I have figured out how t
order them using the TabIndex setting, but can't make it auto select th
next command button after hiting enter on the first command button. I
there a way to do this

--
Baf
-----------------------------------------------------------------------
Bafa's Profile: http://www.excelforum.com/member.php...fo&userid=3774
View this thread: http://www.excelforum.com/showthread.php?threadid=57364


Gary Keramidas

Command button auto select after pressing Enter
 
maybe something like this

Private Sub CommandButton1_Click()
Me.CommandButton2.SetFocus
End Sub

--


Gary


"Bafa" wrote in message
...

I have a user form with 5 text boxes to fill in and 3 command buttons.
Command1 button that needs to be pressed for a function and then
Commend2 labeled "Next" command2 labeled "Back". When I fill in the
first text box and press Enter it automaticly places my curser in the
next text box, and so on. After I fill in the last text box it then
auto selects the Command1 button which perfoms a function for the user.
But it does not go ahead to command2 button, which would take them to
the next page when pressed or hutting Enter. I have figured out how to
order them using the TabIndex setting, but can't make it auto select the
next command button after hiting enter on the first command button. Is
there a way to do this?


--
Bafa
------------------------------------------------------------------------
Bafa's Profile:
http://www.excelforum.com/member.php...o&userid=37748
View this thread: http://www.excelforum.com/showthread...hreadid=573644




Bafa[_13_]

Command button auto select after pressing Enter
 

Thanks again Gary. My project is coming together nicely. Hopefully I
will have it completed by tomorrow and can take it to my interview for
a promotion Wednesday.


--
Bafa
------------------------------------------------------------------------
Bafa's Profile: http://www.excelforum.com/member.php...o&userid=37748
View this thread: http://www.excelforum.com/showthread...hreadid=573644


NickHK

Command button auto select after pressing Enter
 
For these controls, you have a few option to make life easier for the user.

..TabStop=True - Included in the cycle of controls (order determined by
TabIndex) when Tab is pressed.
..Default=True - Simulate a click on this control when Enter is pressed
..Cancel=True - Simulate a click on this control when Esc is pressed

NickHK

"Bafa" wrote in message
...

Thanks again Gary. My project is coming together nicely. Hopefully I
will have it completed by tomorrow and can take it to my interview for
a promotion Wednesday.


--
Bafa
------------------------------------------------------------------------
Bafa's Profile:

http://www.excelforum.com/member.php...o&userid=37748
View this thread: http://www.excelforum.com/showthread...hreadid=573644





All times are GMT +1. The time now is 05:02 AM.

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