title: Excel VBA TextBox Events
body: <p>Would like to ask expert here, why the below code doesn't work in excel sheet ? Basically this code will perform validation on input that user enter into BDTextBox, if format doesn't valid it will pop up a warning message. I've tested this code in excel sheet form and it works well however if change the textbox from form to embedded in excel sheet, it doesn't work.. any idea ?</p>
  
  <pre><code>Private Sub BDTextBox_Exit(ByVal Cancel As MSForms.ReturnBoolean)
  If BDTextBox.Text &lt;&gt; "" Then
      If IsDate(BDTextBox.Text) Then
          BDTextBox.Text = Format(BDTextBox.Text, "yyyymmdd")
          FinalBusinessDate = BDTextBox.Text
      Else
          MsgBox "Please enter a valid date!" &amp; vbNewLine &amp; "Date format could be one of the following" &amp; vbNewLine &amp; "YYYY MM DD" &amp; vbNewLine &amp; "MM DD YYYY" &amp; vbNewLine &amp; "DD MM YYYY", vbCritical
          BDTextBox.Text = ""
          Cancel = True
      End If
  End If
  End Sub
  </code></pre>