Bonsoir Aloys,
je te propose ce fichier : https://www.cjoint.com/c/MICrvXUlQ60
fais Ctrl e ➯ travail effectué. :)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
code VBA de Module1 (25 lignes) :
Option Explicit
Sub SetUnité()
Dim s1$, s2$, d&, i&, n As Byte, f As Byte, c As Byte, p As Byte
d = Cells(Rows.Count, 1).End(3).Row: If d = 1 Then Exit Sub
Application.ScreenUpdating = 0: [B2].Resize(d - 1) = Empty
For i = 2 To d
With Cells(i, 1)
s1 = .Value: n = Len(s1)
If n > 0 Then
s2 = StrReverse$(s1): f = 0
For p = 1 To n
c = Asc(Mid$(s2, p, 1))
If c >= 48 And c <= 57 Then f = 1: Exit For
Next p
If f = 1 Then
.Offset(, 1) = StrReverse$(Trim$(Left$(s2, p - 1)))
.Value = Left$(s1, n - p + 1)
End If
End If
End With
Next i
[A2].Resize(d - 1).HorizontalAlignment = 4
End Sub
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
si besoin, tu peux demander une adaptation ;
à te lire pour avoir ton avis. :)
rhodo