View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jean-Yves[_2_] Jean-Yves[_2_] is offline
external usenet poster
 
Posts: 253
Default using 'enter' on a textbox to activate a command button?

Hi,

Private Sub txtBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
On Error Resume Next
If KeyCode = 13 Then Call yourSub
End Sub
I would make a sub that you either call with the enter key or by the
commandButton.
Don't call the sub under the command button.
Regards,
JY

"neowok " wrote in message
...
i have atext box which the user types into and then a command button
next to it to do a search based on their text. what i would like is to
be able to just type the text and press enter in the text box to
perform the same search. Im pretty sure it can be done quite easily as
I remember doing something similar in VB a few years ago, i just cant
remember how.


---
Message posted from http://www.ExcelForum.com/