1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Sheets("Feuil1").Select
Dim Cellule As Range ' objet Plage
Dim X As String
Dim XX As String
' on itère sur les cellules de C1 jusqu'à la dernière cellule de c remplie
For Each Cellule In Range("c1:c" & Range("c65536").End(xlUp).Row)
If Left(Cellule, X) = Left(Cellule(1, 0), XX) Then
If X < 1 Then Exit For
If XX < 1 Then Exit For
X = (Len(Cellule) - 2)
XX = (Len(Cellule(1, 0)) - 2)
' si égalité aux deux caractères de droite près, on copie en h
Range(Cellule, Cellule(1, 3)).Copy Destination:=Range("h" & Cellule.Row)
End If
Next Cellule |