[Excel] format dans une textbox d'un userform
Fermé
coupidon
Messages postés
98
Date d'inscription
mardi 3 janvier 2006
Statut
Membre
Dernière intervention
23 novembre 2016
-
7 janv. 2006 à 11:56
LADORADE - 16 févr. 2008 à 16:18
LADORADE - 16 févr. 2008 à 16:18
A voir également:
- [Excel] format dans une textbox d'un userform
- Liste déroulante excel - Guide
- Formule excel - Guide
- Telecharger format factory - Télécharger - Conversion & Codecs
- Déplacer une colonne excel - Guide
- Formater un pc - Guide
2 réponses
Bonjour
il faudra 3 textbox nommés textbox1, textbox2, textbox3, un bouton et ce code :
cdt
Mister S
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