Option Explicit
Dim temp 'mémorisation
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ComboBox1.Visible = ActiveCell.Address = "$H$8"
End Sub
Private Sub ComboBox1_GotFocus()
Dim Wb As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False 'si le fichier est déjà ouvert
Application.EnableEvents = False 'évite le déclenchement de la Workbook_Open
On Error Resume Next 'sécurité
Set Wb = Workbooks.Open(ThisWorkbook.Path & "\" & "suivi des producteurs Région Normandie 1.xlsm")
With Evaluate("'" & Wb.Name & "'!Liste") 'avec guillemets anglais
temp = .Resize(Application.CountA(.Cells))
End With
Wb.Close
ComboBox1.List = temp
ComboBox1 = ""
ComboBox1.SelStart = 0
ComboBox1.DropDown
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Private Sub ComboBox1_Change()
Dim t(), c, n As Long
If ComboBox1.ListIndex = -1 Then
ReDim t(0)
For Each c In temp
If UCase(c) Like UCase(ComboBox1) & "*" Then
ReDim Preserve t(n)
t(n) = c
n = n + 1
End If
Next
ComboBox1.List = t
ComboBox1.DropDown
Else
[H8] = ComboBox1
[H8].Select
End If
End Sub