A simplified version of my problem. Consider a single command button on a blank worksheet. I want to be able execute the command button Click event with both the Return key and a mouse click. I want to be able to clear the message box with both the Return key and a mouse click. If I try to clear the message box with the Return key, it also executes the command button Click event again. So using the Return key to clear the message box puts you into a loop. Any ideas are greatly appreciated.
Private Sub Workbook_Open() Sheet1.Button1.Activate End Sub
Private Sub Button1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Select Case KeyCode 'Return is only key press that we care about Case vbKeyReturn Call Button1_Click End Select End Sub Private Sub Button1_Click() MsgBox "I am stuck in a loop when I use the Return key to clear this message box" & vbNewLine & "but everything is fine if I use a mouse click to clear this message box" End Sub