Sub ImportFm()
With ActiveSheet
ChargerLaListeDesFM .Range("A2:A800")
End With
End Sub
Sub ChargerLaListeDesFM(ByVal AireFM As Range)
Dim I As Integer, J As Integer, K As Integer
Dim ListeFm As Object
Dim Fm As String
Dim ListeCles As Variant, TabFm As Variant, Temp1 As Variant
Range(AireFM.Offset(0, 1), AireFM.Offset(0, 9)).ClearContents
For K = 1 To AireFM.Count
TabFm = Split(AireFM(K), "FM")
Temp1 = ""
Set ListeFm = CreateObject("Scripting.Dictionary")
For I = LBound(TabFm) To UBound(TabFm)
Select Case Mid(TabFm(I), 1, 1)
Case 0 To 9
Fm = "FM" & Mid(TabFm(I), 1, 5)
If Not ListeFm.Exists(Fm) Then ListeFm.Add Fm, Fm
End Select
Next I
ListeCles = ListeFm.keys
' Tri des FM par ordre alphabétique
'----------------------------------
For I = LBound(ListeCles) To UBound(ListeCles) - 1
For J = I + 1 To UBound(ListeCles)
If ListeCles(I) > ListeCles(J) Then
Temp1 = ListeCles(I)
ListeCles(I) = ListeCles(J)
ListeCles(J) = Temp1
End If
Next J
Next I
' Mise à jour du tableau
'-----------------------
For I = LBound(ListeCles) To UBound(ListeCles)
If ListeCles(I) <> "" Then AireFM(K).Offset(0, I + 1) = ListeCles(I)
Next I
Erase ListeCles
Set ListeFm = Nothing
Next K
Set ListeFm = Nothing
End Sub