im Archiv fand ich folgenden Code, der genau das macht was ich brauche. Ganze Tabelle mit eingegebenem Wert aus Textbox durchsuchen - anzeigen in zweispaltiger ListBox plus Wert aus erster Zelle. Das Ganze befindet sich in einer Userform.
Meine Frage nun:
Wie schaffe ich es, dass bei Klick auf den entsprechenden Eintrag in der Listbox der Inhalt der Zellen der gefundenen Zeile (A bis AE) in einzelnen Textboxen angezeigt wird? Es sollen aber nicht alle Zellen, sondern nur bestimmte angezeigt werden.
Bin für jeden Hinweis dankbar.
Gruß
Ralf (aus dem Schwabenlande)
Private Sub CommandButton2_Click()
Dim s As String
Dim Found As Range
Dim FirstAddress As String
Dim I As Integer
I = 0
If txtSuche.Text = "" Then
MsgBox "Kein Eintrag vorhanden!", vbCritical, "Suchwort eingeben!"
txtSuche.SetFocus
Else
End If
Eingabe = txtSuche.Text
If Eingabe = "" Then Exit Sub
ListBox1.Clear
With ActiveSheet
Set Found = .Cells.Find(Eingabe, LookAt:=xlPart)
If Not Found Is Nothing Then
FirstAddress = Found.Address
ListBox1.ColumnCount = 2
ListBox1.AddItem Found
ListBox1.List(I, 1) = Cells(Found.Row, 1)
I = I + 1
Do
Found.Activate
Set Found = Cells.FindNext(After:=ActiveCell)
On Error Resume Next
If Found.Address = FirstAddress Then Exit Do
ListBox1.AddItem Found
ListBox1.List(I, 1) = Cells(Found.Row, 1)
I = I + 1
Loop
End If
End With
CommandButton2.Caption = "Neue Suche"
txtSuche.SetFocus
txtSuche.Value = ""
End Sub