Suche per VBA
23.07.2018 08:46:30
Ing.
Ich wäre für einen Tipp sehr dankbar.
Tom
Private Sub CommandButton11_Click()
Dim c As Range
Dim rngBereich As Range
Dim lngAnzahl As Long
Dim strFirst As String
With Sheets("Stammdaten")
Set rngBereich = .Columns("A:Z")
Set c = rngBereich.Find(Suche, LookIn:=xlValues, lookat:=xlPart)
If Not c Is Nothing Then
strFirst = c.Address
Do
ListBox2.Clear
ListBox2.AddItem .Cells(c.Row, 9)
lngAnzahl = ListBox2.ListCount
ListBox2.List(lngAnzahl - 1, 1) = .Cells(c.Row, 1)
ListBox2.List(lngAnzahl - 1, 2) = .Cells(c.Row, 2)
ListBox2.List(lngAnzahl - 1, 3) = .Cells(c.Row, 3)
ListBox2.List(lngAnzahl - 1, 4) = .Cells(c.Row, 8)
Set c = rngBereich.FindNext(c)
Loop While Not c Is Nothing And c.Address strFirst
End If
End With
End Sub