Public WithEvents tbxdate As MSForms.TextBox
Dim cl(10) As New FicheInscription
Private Sub tbxdate_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    With tbxdate
        v = .Value
        Select Case KeyCode
        Case 96 To 105
            If Len(v) = 2 Or Len(v) = 5 Then v = v & "/"
            v = v & Chr(KeyCode - 48)
            If Val(v) > 31 Then v = ""
       If Len(v) >= 5 Then If Mid(v, 4, 2) > 12 Then v = Left(v, 3)
        KeyCode = 0
        Case 8: v = Left(v, InStrRev(v, "/") + 1)
        Case 46
        Case Else: KeyCode = 0
        End Select
         If Len(v) = 2 Or Len(v) = 5 Then v = v & "/"
          .Value = Mid(v, 1, 10)
    If Len(v) = 10 And Not IsDate(v) Then .Value = "": Beep: MsgBox "la date saisie n'est pas valide"
    End With
End Sub
Private Sub tbxdate_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    If Button = 2 Then tbxdate = Calendar.ShowX(tbxdate, 2, 0, 1)
End Sub
Private Sub UserForm_Activate()
    For Each ctrl In Me.Controls
        If ctrl.ControlTipText = "date" Then A = A + 1: Set cl(A).tbxdate = ctrl
    Next
End Sub