Bonjour,
Je n'ai pas d'idée particulière sur la question. Seule une macro conçue spécialement pour ça me semble appropriée.
Sub Galopin()
Dim WsA As Worksheet
Dim a, b, rng As Range, i&, iC%, k%, cpt%
[A1].CurrentRegion.Offset(1).ClearContents
b = Split("05474000 06677000 07721000 07966000 08304000 08323000 98000000 98510000")
Set rng = Feuil3.[A1].CurrentRegion
With rng
Set rng = .Resize(.Rows.Count, .Columns.Count + 1)
End With
a = rng.Value
iC = UBound(a, 2)
cpt = 1
a(1, iC) = cpt
For k = LBound(b) To UBound(b)
cpt = cpt + 1
For i = 2 To UBound(a)
If a(i, 1) = b(k) Then
a(i, iC) = cpt
Exit For
End If
Next
Next
a(1, iC) = cpt + 1
ActiveSheet.[A1].Resize(UBound(a), UBound(a, 2)) = a
ActiveSheet.[A1].CurrentRegion.Sort key1:=Cells(1, iC), order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Columns(iC).Delete
End Sub
A+