in meiner Mappe wird mit dem Button "Suchen" eine UF geöffnet. Ich trage dann z.B. das Wort "Brot" ein. Wie schaffe ich es, dass in der dortigen Listbox auch die Daten der Spalte "Anmerkung" angezeigt werden.
Hier noch der Code:
Option Explicit
Private Sub cmdSearch_Click()
Dim objSH As Worksheet
Dim rngSearch As Range
Dim strFirst As String
Dim Lz As Long
If txtSearch "" Then
ListBox1.Clear
Set objSH = Sheets("Kassabuch")
With objSH
Lz = Application.Max(7, .Cells(Rows.Count, 2).End(xlUp).Row)
Set rngSearch = .Range("A7:G" & Lz).Find(What:=txtSearch, LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False, After:=.Cells(7, 1))
If Not rngSearch Is Nothing Then
strFirst = rngSearch.Address
Do
ListBox1.AddItem .Cells(rngSearch.Row, 1)
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(rngSearch.Row, 2)
ListBox1.List(ListBox1.ListCount - 1, 2) = .Cells(rngSearch.Row, 3)
ListBox1.List(ListBox1.ListCount - 1, 3) = .Cells(rngSearch.Row, 4)
ListBox1.List(ListBox1.ListCount - 1, 4) = .Cells(rngSearch.Row, 5)
ListBox1.List(ListBox1.ListCount - 1, 5) = .Cells(rngSearch.Row, 7)
Set rngSearch = .Range("A7:G" & Lz).FindNext(rngSearch)
Loop While Not rngSearch Is Nothing And rngSearch.Address strFirst
ListBox1.ColumnWidths = "60;80;80;80;150;150"
End If
End With
If ListBox1.ListCount = 0 Then ListBox1.AddItem "Kein Treffer!"
End If
End Sub
Und hier die Mappe:
https://www.herber.de/bbs/user/120783.xlsm
Besten Dank für die Hilfe, Servus Walter