Dim choix1()
Private Sub UserForm_Initialize()
choix1 = [liste].Value
Me.ComboBox1.List = choix1
End Sub
Private Sub ComboBox1_Change()
Dim b()
Me.TextBox1 = ""
'Me.TextBox2 = ""
tmp = "*" & UCase(Me.ComboBox1) & "*"
n = 0
For i = LBound(choix1) To UBound(choix1)
If UCase(choix1(i, 1)) Like tmp Or UCase(choix1(i, 2)) Like tmp Then
'If UCase(choix1(i, 1)) Like tmp Or UCase(choix1(i, 2))Like tmp Or UCase(choix1(i, 3)) Like tmp Then
n = n + 1: ReDim Preserve b(1 To 3, 1 To n)
' n = n + 1: ReDim Preserve b(1 To 4, 1 To n)
b(1, n) = choix1(i, 1): b(2, n) = choix1(i, 2): b(3, n) = choix1(i, 3)
' b(1, n) = choix1(i, 1): b(2, n) = choix1(i, 2): b(3, n) = choix1(i, 3): b(4, n) = choix1(i,4 )
End If
Next i
If n > 0 Then
Me.ComboBox1.Column = b
Me.ComboBox1.DropDown
Else
Me.ComboBox1.Clear
End If
End Sub
Private Sub ComboBox1_click()
On Error Resume Next
Me.TextBox1 = Me.ComboBox1.Column(1)
Me.TextBox2 = Me.ComboBox1.Column(2)
Me.TextBox3 = Me.ComboBox1.Column(3)
End Sub
Private Sub CommandButton1_Click()
If Me.TextBox1 <> "" Then
ActiveCell = UCase(Me.ComboBox1)
ActiveCell.Offset(0, 1) = Me.TextBox1
ActiveCell.Offset(0, 2) = Me.TextBox2
ActiveCell.Offset(0, 3) = Me.TextBox3
Unload Me
End If
End Sub