title: DateDiff Formula in a UserForm
body: <p>I have two textboxes that contain a start date and a end date. </p>
  
  <p>I want to get a number that represents the days that are between those two.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Private Sub TextBox20_Exit(ByVal Cancel As MSForms.ReturnBoolean)
      'check date format
      With TextBox20
          If IsDate(TextBox20.Text) Then 'Format as desired.
              TextBox20.Text = Format(CDate(TextBox20.Text), "Dddd, d Mmm yyyy", vbMonday)
          Else
              TextBox20.Text = "" 'Clear the TextBox
              MsgBox "Por favor, ingresar una fecha valida."
              Cancel = True
              Exit Sub
          End If
      End With
  End Sub
  
  Private Sub TextBox21_Exit(ByVal Cancel As MSForms.ReturnBoolean)
      'check date format
      With TextBox21
          If IsDate(TextBox21.Text) Then 'Format as desired.
              TextBox21.Text = Format(CDate(TextBox21.Text), "Dddd, d Mmm yyyy", vbMonday)
          Else
              TextBox21.Text = "" 'Clear the TextBox
              MsgBox "Por favor, ingresar una fecha valida."
              Cancel = True
              Exit Sub
          End If    
      End With
  End Sub
  
  Private Sub TextBox22_AfterUpdate()
  TextBox22.Value = DateDiff("d", CDate(TextBox20.Value), CDate(TextBox21.Value), vbMonday)    
  End Sub
  </code></pre>
  
  <p>I thought it was because I had the TextBoxes as <code>.Text</code> and not <code>.Value</code>, but yet nothing changes.</p>