|
|
|
|
Bonjour
il faudra 3 textbox nommés textbox1, textbox2, textbox3, un bouton et ce code : Private Sub CommandButton1_Click() Dim date1 As Date Dim date2 As Date date1 = TextBox1 date2 = TextBox2 Textbox3 = date1 - date2 End Sub Private Sub TextBox1_LostFocus() If Len(TextBox1) = 6 Then TextBox1 = Mid(TextBox1.Text, 1, 2) & "/" & Mid(TextBox1.Text, 3, 2) & "/" & is19_20(Mid(TextBox1.Text, 5, 2)) & Mid(TextBox1.Text, 5, 2) End Sub Private Sub TextBox2_LostFocus() If Len(TextBox2) = 6 Then TextBox2 = Mid(TextBox2.Text, 1, 2) & "/" & Mid(TextBox2.Text, 3, 2) & "/" & is19_20(Mid(TextBox2.Text, 5, 2)) & Mid(TextBox2.Text, 5, 2) End Sub Function is19_20(val As Integer) 'ici je considere qu'en dessous de 50 on mettra 20xx sinon 19xx pour l'annee is19_20 = IIf(val < 50, "20", "19") End Function cdt Mister S |
Bien beau ton truc mais ou j'ai pas compris ou ça fonctionne pas. |
Résultats pour [Excel] format dans une textbox d'un userform
Résultats pour [Excel] format dans une textbox d'un userform
Résultats pour [Excel] format dans une textbox d'un userform