title: how to keep setfocus in textbox - vba excel
body: <p>I'm new in VBA, first I have a <code>userform</code>, <code>textbox1</code> and a <code>commandbutton1</code>. I have problem when I enter or press <code>Tab</code> in <code>textbox1</code> , I want textbox1 still in <code>setfocus</code> but it clicked <code>commandbutton1</code>.</p>
  
  <p>I have code below:</p>
  
  <pre><code>Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
  ByVal Shift As Integer)
      If KeyCode = 13 Then
          TextBox1.SetFocus
      End If
  End Sub
  </code></pre>
  
  <p>and what's VBA code to close userform1 when I press "F4" on keyboard?
  thank you...</p>