Dim memo As String 'mémorise la variable
Private Sub ComboBox1_GotFocus()
Dim r As Range, n As Long
Set r = Range("A2", Range("A" & Rows.Count).End(xlUp)(2))
Application.ScreenUpdating = False
If FilterMode Then ShowAllData 'si la feuille est filtrée
ComboBox1.Clear
ComboBox1 = ""
If Application.CountA(r) = 0 Then Exit Sub
With [D1].Resize(r.Count, 2) '2 colonnes auxiliaires
.Columns(1) = "=REPT(A2&REPT("" ""&C2,C2<>""""),ISNUMBER(SEARCH(""" & memo & """,A2&REPT("" ""&C2,C2<>""""))))"
.Columns(2) = "=B2"
.Value = .Value 'supprime les formules
n = Application.CountA(.Columns(1))
If n Then
.Sort .Cells(1), xlAscending, Header:=xlNo 'tri alphabétique
ComboBox1.List = .Resize(n).Value
End If
.ClearContents
End With
ComboBox1.DropDown 'déroule la liste
End Sub
Private Sub ComboBox1_Change()
If memo <> "" Then Exit Sub
Application.ScreenUpdating = False
With ComboBox1
memo = .Text
ActiveCell.Activate 'ôte le focus pour fermer la liste
ComboBox1.Activate 'lance ComboBox1_GotFocus
.Text = memo
memo = ""
[H7] = "" 'RAZ
If .ListIndex > -1 Then [H7] = .List(.ListIndex, 1) 'valeur en 2ème colonne
End With
End Sub