Dim flag As Boolean 'mémorise la variable
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With ComboBox1
If ActiveCell.Row < 9 Or ActiveCell.Column <> 6 Then .Visible = False: Exit Sub
.MatchEntry = fmMatchEntryNone
.Left = ActiveCell.Left
.Top = ActiveCell.Top
.Width = ActiveCell.Width + 2
flag = True
ComboBox1 = ActiveCell
If ComboBox1.ListCount = 0 Then ComboBox1_Change 'crée la liste
flag = False
.Visible = True
.Activate
End With
End Sub
Private Sub ComboBox1_Change()
Dim i As Variant
With Feuil1.[A1].CurrentRegion
.Sort .Columns(1), xlAscending, Header:=xlNo 'tri
i = Application.Match(ComboBox1 & "*", .Columns(1), 0)
If IsError(i) Then ComboBox1 = "": Exit Sub
ComboBox1.List = .Cells(i, 1).Resize(Application.CountIf(.Columns(1), ComboBox1 & "*"), 2).Value
ActiveCell = IIf(ComboBox1.ListIndex = -1, "", ComboBox1)
If Not flag Then ComboBox1.DropDown
End With
End Sub