Dim a()
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect([b4], Target) Is Nothing And Target.Count = 1 Then
UserForm1.Left = Target.Left + 150
UserForm1.Top = Target.Top + 90 - Cells(ActiveWindow.ScrollRow, 1).Top
UserForm1.Show
End If
If Not Intersect([c9], Target) Is Nothing And Target.Count = 1 Then
a = Sheets("REF_CLIENT").Range("client").Value
Me.ComboBox3.List = a
Me.ComboBox3.Height = Target.Height + 3
Me.ComboBox3.Width = Target.Width
Me.ComboBox3.Top = Target.Top
Me.ComboBox3.Left = Target.Left
Me.ComboBox3 = Target
Me.ComboBox3.Visible = True
Me.ComboBox3.Activate
If Target <> "" Then SendKeys "{esc}"
'Me.test.DropDown ' ouverture automatique au clic dans la cellule (optionel)
Else
Me.ComboBox3.Visible = False
End If
End Sub
Private Sub ComboBox3_Change()
If Me.ComboBox3 <> "" Then
Set d1 = CreateObject("Scripting.Dictionary")
tmp = UCase(Me.ComboBox3) & "*"
For Each c In a
If UCase(c) Like tmp Then d1(c) = ""
Next c
Me.ComboBox3.List = d1.keys
Me.ComboBox3.DropDown
End If
ActiveCell.Value = Me.ComboBox3
End Sub
Private Sub ComboBox3_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Me.ComboBox3.List = a
Me.ComboBox3.Activate
Me.ComboBox3.DropDown
End Sub
Private Sub ComboBox3_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then ActiveCell.Offset(1).Select
End Sub