AW: Listbox auf mehrere Spalten erweitern
28.04.2017 15:22:19
ChrisL
Hi Herbert
ListBox Eigenschaft ColumnWidth z.B. 10cm;5cm;3cm;2cm;1cm
Private Sub CommandButton1_Click()
Dim i As Byte
For i = 1 To 5
Controls("TextBox" & i) = ""
Next i
End Sub
Private Sub TextBox1_Change()
Call RefreshLB
End Sub
Private Sub TextBox2_Change()
Call RefreshLB
End Sub
Private Sub TextBox3_Change()
Call RefreshLB
End Sub
Private Sub TextBox4_Change()
Call RefreshLB
End Sub
Private Sub TextBox5_Change()
Call RefreshLB
End Sub
Private Sub RefreshLB()
Dim i As Long, j As Byte, b As Boolean
ListBox1.Clear
For i = 2 To Tabelle1.UsedRange.Rows.Count
b = True
For j = 1 To 5
If Controls("TextBox" & j) "" Then
If Not UCase(Tabelle1.Cells(i, j)) Like "*" & UCase(Controls("TextBox" & j)) & "*" _
Then
b = False
Exit For
End If
End If
Next j
If b Then
ListBox1.AddItem (Tabelle1.Cells(i, 1))
ListBox1.List(ListBox1.ListCount - 1, 1) = Tabelle1.Cells(i, 2)
ListBox1.List(ListBox1.ListCount - 1, 2) = Tabelle1.Cells(i, 3)
ListBox1.List(ListBox1.ListCount - 1, 3) = Tabelle1.Cells(i, 4)
ListBox1.List(ListBox1.ListCount - 1, 4) = Tabelle1.Cells(i, 5)
End If
Next i
End Sub
cu
Chris