hi everyone,

I have a problem in using keypress event in excel. i have this code but it doesn't work. What i want to do is after I input a value in the textbox and press then Enter key the Commandbutton2_click will activate. Can anyone help me.

Thanks and Regards,
Kevin

Code:
Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 13 Then
CommandButton2_Click
End If
End Sub