Using the enter key

G

Guest

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.
 
N

Norman Jones

Hi SC,

Try:

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top