ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using the enter key (https://www.excelbanter.com/excel-programming/367327-using-enter-key.html)

sc

Using the enter key
 
I have a textbox and two commandbuttons on a userform. One of the buttons is
to unload the userform and the other is to add the contents from the textbox
to a worksheet. I do not want to click the button everytime. I would just
like to press the enter key to execute the code. I have looked every where
to see how this is done but with no success. Any help will be much
appreciated.

Norman Jones

Using the enter key
 
Hi SC,

Try:

'=============
Private Sub UserForm_Initialize()
Me.CommandButton1.Default = True
End Sub
'<<=============



---
Regards,
Norman



"sc" wrote in message
...
I have a textbox and two commandbuttons on a userform. One of the buttons
is
to unload the userform and the other is to add the contents from the
textbox
to a worksheet. I do not want to click the button everytime. I would
just
like to press the enter key to execute the code. I have looked every
where
to see how this is done but with no success. Any help will be much
appreciated.





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

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