format textbox securite sociale

GHISLAIN

XLDnaute Impliqué
bonjour le forum,

voila l editeur de macro me propose
Selection.NumberFormat = _
"[>=3000000000000]#"" ""##"" ""##"" ""##"" ""###"" ""###"" | ""##;#"" ""##"" ""##"" ""##"" ""###"" ""###"
pour transformer un numero en format securite social




je cherche a mettre dans l evenement change ce type de format sans y parvenir

quelqu un aurait il la solution??

TextBox20.Value = Format(TextBox20.Value, " #"" ""##"" ""##"" ""##"" ""###"" ""###"" | ""##;#"" ""##"" ""##"" ""##"" ""###"" ""###")


cordialement

GHISLAIN
 

GHISLAIN

XLDnaute Impliqué
Re : format textbox securite sociale

re tous,

j ai trouvé e code sur excel labo pour ceux qui en aurait besoin

Private sub txtSS_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
Dim nc As Integer, s As String
s = Trim(txtSSS): nc = Len(s)

If nc = 0 Then exit sub
If (nc <> 15 And nc <> 13) Or Not IsNumeric(s) Then
MsgBox "Vous devez entrer 13 ou 15 chiffres sans espaces", , "Test"
txtSSS = ""
Else
txtSSS = Format(s, IIf(nc = 15, "0 00 00 00 000 000|00", _
"0 00 00 00 000 000"))
End If

end sub


cordialement

GHISLAIN
 

Statistiques des forums

Discussions
312 352
Messages
2 087 525
Membres
103 576
dernier inscrit
Pilliars