https://stackoverflow.com/a/31124960/5079799
Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If KeyCode = vbKeyReturn Then Call OkButton_Click ElseIf KeyCode = vbKeyEscape Then Call CancelButton_Click End If End Sub