Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 13 Then
'User pressed the enter key...do something
Else
'User pressed some other key
End If
End Sub
*cLFlaVA
----------------------------
A polar bear walks into a bar and says, "Can I have a ... beer?"
The bartender asks, "What's with the big pause?
Would you mind if I ask WHY you want to detect when Enter is pressed? Various actions happen when a User presses the Enter key; most, if not all, of the actions can be achieved in some other way so detecting the key press is not a very useful way of detecting User intention.
Enjoy,
Tony
-------------------------------------------------------------------------------------------- We want to help you; help us to do it by reading this: Before you ask a question.
If you set the button property Default to True, then pressing Enter will act exactly as though the button were pressed.
Enjoy,
Tony
-------------------------------------------------------------------------------------------- We want to help you; help us to do it by reading this: Before you ask a question.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.