Bei dem folgenden Code (hier aus dem Archiv. Danke dafür!)
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
Dim liSuche As Integer, liMsg As Integer, liSuche1 As Integer
For liSuche = 0 To ListBox1.ListCount - 1
For liSuche1 = 0 To ListBox1.ColumnCount - 1
If InStr(1, LCase(ListBox1.Column(liSuche1, liSuche)), LCase(TextBox1.Text)) _
> 0 Then
ListBox1.ListIndex = liSuche
End If
Next
Next
TextBox1.Text = ""
End If
End Sub
suche ich in einer ListBox über eine TextBox z. B. den Eintrag mann. Der Eintag wird in der Liste gefunden und markiert.
Das funktionier auch super. Jetzt meine Frage...
Wie kann ich mir mit dem Code alle Einträge die mann enthalten in meiner ListBox anzeigen bzw. auflisten lassen?
Meine ListBox wird mit dem folgenden Code gefüllt.
Private Sub UserForm_initialize()
Dim i As Integer
Dim sh As Worksheet
Set sh = Sheets("Übersicht")
UserForm3.ListBox1.ColumnCount = 3
UserForm3.ListBox1.ColumnWidths = "0,0 cm; 1,8 cm; 5,5 cm"
For i = 4 To 103
If sh.Cells(i, 3) = "G" Then
ListBox1.AddItem sh.Cells(i, 2) '2 = Spalte B
ListBox1.List(ListBox1.ListCount - 1, 1) = Left(sh.Cells(i, 2), 10) '2 = Spalte B
ListBox1.List(ListBox1.ListCount - 1, 2) = sh.Cells(i, 4) '4 = Spalte D
End If
Next i
End Sub
Ich danke im voraus für Eure Hilfe!
Gruß, Mike