Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Linking the ENTER key to a Button on a Form?

Hi folks,

I'm creating a User Form in Excel. It includes a Text Box and a
number of buttons.

When the user types into the Text Box and (instinctively) presses
ENTER, is there a way to simulate the clicking of a button? In other
words, can ENTER - when pressed from the Text Box - be used to trigger
the code behind a button?

Many thanks,

Jason Paris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Linking the ENTER key to a Button on a Form?

Hi,

Your textbox name is TextBox1, your button name is btnOK:

Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode = 13 Then btnOK_Click
End Sub

Private Sub btnOK_Click()
MsgBox "OK launched by ENTER"
End Sub

Regards,

Manu/

"Jason Paris" a écrit dans le message de news:
...
Hi folks,

I'm creating a User Form in Excel. It includes a Text Box and a
number of buttons.

When the user types into the Text Box and (instinctively) presses
ENTER, is there a way to simulate the clicking of a button? In other
words, can ENTER - when pressed from the Text Box - be used to trigger
the code behind a button?

Many thanks,

Jason Paris



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to make the enter button work as regular enter Ricter Excel Discussion (Misc queries) 1 November 17th 09 02:50 AM
Create a form in excel so I can enter data using DataForm Lynn Excel Discussion (Misc queries) 2 February 14th 07 06:35 PM
Command Button vs Form Button Bri[_3_] Excel Programming 2 February 3rd 06 08:18 AM
enter button in vb brian parry Excel Programming 0 April 23rd 04 08:07 PM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM


All times are GMT +1. The time now is 11:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"