Option Explicit
Private Sub CommandButton1_Click()
Range("a1") = Join(Array(TextBox4, TextBox3, TextBox2), "/")
End Sub
Private Sub TextBox2_Change(): verif TextBox2: End Sub
Private Sub TextBox3_Change(): verif TextBox3: End Sub
Private Sub TextBox4_Change(): verif TextBox4: End Sub
Sub verif(txtb)
Dim x$
CommandButton1.Enabled = False
Select Case txtb.Name
Case "TextBox2": If Val(txtb.Text) > 31 Then txtb.Value = "": Beep
If Len(txtb.Value) = 2 Then TextBox3.SetFocus
Case "TextBox3"
If Val(txtb.Text) > 12 Then txtb.Value = "": Beep
If Len(txtb.Value) = 2 And Not IsDate(TextBox2.Value & "/" & txtb.Value & "/2000") Then txtb.Value = "": Beep: 'TextBox4.Value = ""
If Len(txtb.Value) = 2 Then TextBox4.SetFocus
Case "TextBox4"
If Len(txtb.Value) = 4 Then
If Not IsDate(TextBox2.Value & "/" & TextBox3.Value & "/" & txtb.Value) Then txtb.Value = "": Beep 'Else CommandButton1.Enabled = True
End If
End Select
x = Join(Array(TextBox4, TextBox3, TextBox2), "/")
If Len(x) = 10 And IsDate(x) Then CommandButton1.Enabled = True
End Sub