Private Sub ListBox1_Click() [BD2] = ListBox1.List(ListBox1.ListIndex, 1) [BD3] = ListBox1.List(ListBox1.ListIndex, 0) [BD4] = ListBox1.List(ListBox1.ListIndex, 3) [BR2] = ListBox1.List(ListBox1.ListIndex, 2) End Sub
Private Sub TextBox1_Change() Dim LastRow As Long, i As Long, x As Long, Arr() Me.ListBox1.Clear If TextBox1 = "" Then Exit Sub With Sheets("base_online") LastRow = .Cells(Rows.Count, 3).End(xlUp).Row Arr = .Range(.Cells(3, 2), .Cells(LastRow, 5)).Value End With With ListBox1 For i = 1 To UBound(Arr) If UCase(Arr(i, 2)) Like UCase(Me.TextBox1) & "*" Then .AddItem .List(ListBox1.ListCount - 1, 0) = Arr(i, 2) .List(ListBox1.ListCount - 1, 1) = Arr(i, 1) .List(ListBox1.ListCount - 1, 2) = Arr(i, 3) .List(ListBox1.ListCount - 1, 3) = Arr(i, 4) End If Next End With End Sub
[/vba]
[vba]
Код
Private Sub ListBox1_Click() [BD2] = ListBox1.List(ListBox1.ListIndex, 1) [BD3] = ListBox1.List(ListBox1.ListIndex, 0) [BD4] = ListBox1.List(ListBox1.ListIndex, 3) [BR2] = ListBox1.List(ListBox1.ListIndex, 2) End Sub
Private Sub TextBox1_Change() Dim LastRow As Long, i As Long, x As Long, Arr() Me.ListBox1.Clear If TextBox1 = "" Then Exit Sub With Sheets("base_online") LastRow = .Cells(Rows.Count, 3).End(xlUp).Row Arr = .Range(.Cells(3, 2), .Cells(LastRow, 5)).Value End With With ListBox1 For i = 1 To UBound(Arr) If UCase(Arr(i, 2)) Like UCase(Me.TextBox1) & "*" Then .AddItem .List(ListBox1.ListCount - 1, 0) = Arr(i, 2) .List(ListBox1.ListCount - 1, 1) = Arr(i, 1) .List(ListBox1.ListCount - 1, 2) = Arr(i, 3) .List(ListBox1.ListCount - 1, 3) = Arr(i, 4) End If Next End With End Sub