Option Explicit
Option Compare Text
Dim TBL
Private Sub ComboBox1_DropButtonClick()
ComboBox1.List = TBL
End Sub
Private Sub ComboBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
recall ComboBox1.Text & Chr(KeyAscii)
ComboBox1.DropDown
If Len(ComboBox1.Text & Chr(KeyAscii)) > 2 Then KeyAscii = 0
End Sub
Private Sub ComboBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
recall ComboBox1.Text
ComboBox1.DropDown
End Sub
Private Sub UserForm_Activate()
Dim I&
TBL = Range("tableau3").Resize(, 4)
For I = 1 To UBound(TBL): TBL(I, 3) = I: Next
ComboBox1.List = TBL
End Sub
Sub recall(v)
Dim I&, tbl2(), a&
Me.Caption = "*" & Replace(v, " ", "*") & "*"
ComboBox2.Clear
For I = 1 To UBound(TBL)
If " " & TBL(I, 2) & " " Like ("*" & Replace(v, " ", "*") & "*") Then
a = a + 1: ReDim Preserve tbl2(1 To 3, 1 To a)
tbl2(1, a) = TBL(I, 1)
tbl2(2, a) = TBL(I, 2)
tbl2(3, a) = TBL(I, 3)
End If
Next
ComboBox1.Column = tbl2
ComboBox1.Text = v
End Sub