Function Traitement(t As String)
Dim a, L As Integer, i As Integer
t = Trim(t) 'supprime les espaces à gauche et à droite
Select Case Mid(t, 7, 1)
Case 1
a = Array(7, 8, 9, 13, 15, 17)
t = Nombre(t) 'traitement du nombre
Case 2: a = Array(7, 8) 'et non pas 7, 8, 9...
Case Else: Traitement = t: Exit Function
End Select
'---insertion d'espaces---
L = Len(t)
For i = UBound(a) To 0 Step -1
If a(i) <= L Then t = Application.Replace(t, a(i), 0, " ") 'fonction REMPLACER
Next
Traitement = t
End Function
Function Nombre(t As String)
Dim n As Variant, c As Byte
n = Val(Right(t, 8)) / 10
c = Asc(Right(t, 1))
Select Case c
Case 233, 123: n = Format(n, "+0.0") & 0 'é ou {
Case 232, 125: n = Format(n, "-0.0") & 0 'è ou }
Case 65 To 73: n = Format(n, "+0.0") & Chr(c - 16) 'A à I
Case 74 To 82: n = Format(n, "-0.0") & Chr(c - 25) 'J à R
Case Else: Nombre = t: Exit Function
End Select
Nombre = Left(t, Len(t) - 8) & n
End Function