Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [A1:A1000]) Is Nothing Or Target.Count > 1 Then Exit Sub
If Not IsNumeric(Target) Then Exit Sub
Dim txt, n
txt = Left(Target, 10) '10 chiffres maximum
n = Len(txt)
If n > 9 Then txt = Application.Replace(txt, 10, , "-")
If n > 7 Then txt = Application.Replace(txt, 8, , "-")
If n > 3 Then txt = Application.Replace(txt, 4, , "-")
Target.NumberFormat = "@" 'format texte
Application.EnableEvents = False
Target = txt
Application.EnableEvents = True
End Sub