Hoffe mir kann jemand weiterhelfen.
Bin schon sehr weit gekommen mit meinem Code.....
Hab ein Userform mit Suchfunktion erstellt. Darunterliegend eine Listbox welche mir das Such-Ergebnis anzeigt. Ich möchte nun, aus dem Suchergebnis mit Doppelklick in Listbox-Zeile in mein Tabellenblatt auf die ausgewählte Zeile springen. Die Spalte zwei in der Listbox zeigt mir die Zellennummer in der Tabelle "Overview" an.
Liebe Gruess
Richi
----------Dieser Code funktioniert nicht. Ehrlich gesagt ich hab vielzuwenig Know How um hier weiter zu kommen-----------------
Private Sub TextBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim wb As Workbook 'Datei
Dim wsZ As Worksheet 'Tabelle
Set wb = ThisWorkbook 'Geöffnete Datei
Set wsZ = wb.Worksheets("Overview") 'Tabelle
wsZ.Cells(Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1), 1).Select
End Sub
------------------------------------------------------------------------------------------------------------------------------
Private Sub UserForm_Initialize()
Dim wb As Workbook 'Datei
Dim wsZ As Worksheet 'Tabelle
Dim lzZ As Long 'Letzte Spalte
Set wb = ThisWorkbook 'Geöffnete Datei
Set wsZ = wb.Worksheets("Overview") 'Tabelle
lzZ = wsZ.Cells(wsZ.Rows.Count, "A").End(xlUp).Row 'letzte Zeile Ziel ermitteln
Dim Zeile, X As Long
'Schleife über alle Zeilen der Tabelle
For Zeile = 15 To lzZ
If wsZ.Cells(Zeile, 19) = "Overview" Then
X = Zeile
Me.ListBox1.AddItem wsZ.Cells(Zeile, 1)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) = Zeile
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 2) = wsZ.Cells(Zeile, 3)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 3) = wsZ.Cells(Zeile, 4)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 4) = wsZ.Cells(Zeile, 5)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 5) = wsZ.Cells(Zeile, 6)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 6) = wsZ.Cells(Zeile, 7)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 7) = wsZ.Cells(Zeile, 8)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 8) = wsZ.Cells(Zeile, 9)
End If
Next Zeile
'Erstes Element als Default auswählen
Me.ListBox1.Selected(0) = True
End Sub
Private Sub TextBox1_Change()
Dim Zeile As Long
Dim wb As Workbook 'Datei
Dim wsZ As Worksheet 'Tabelle
Dim lzZ As Long 'Letzte Spalte
Set wb = ThisWorkbook 'Geöffnete Datei
Set wsZ = wb.Worksheets("Overview") 'Tabelle
lzZ = wsZ.Cells(wsZ.Rows.Count, "A").End(xlUp).Row 'letzte Zeile Ziel ermitteln
Me.ListBox1.Clear
'Schleife über alle Zeilen der Tabelle
For Zeile = 15 To lzZ
If wsZ.Cells(Zeile, 19) = "Overview" Then
X = Zeile
If InStr(1, LCase(wsZ.Cells(Zeile, 1).Value), LCase(Me.TextBox1.Value)) 0 Or _
InStr(1, LCase(wsZ.Cells(Zeile, 3).Value), LCase(Me.TextBox1.Value)) 0 Or _
InStr(1, LCase(wsZ.Cells(Zeile, 4).Value), LCase(Me.TextBox1.Value)) 0 Or _
InStr(1, LCase(wsZ.Cells(Zeile, 5).Value), LCase(Me.TextBox1.Value)) 0 Or _
InStr(1, LCase(wsZ.Cells(Zeile, 6).Value), LCase(Me.TextBox1.Value)) 0 Or _
InStr(1, LCase(wsZ.Cells(Zeile, 7).Value), LCase(Me.TextBox1.Value)) 0 Or _
InStr(1, LCase(wsZ.Cells(Zeile, 8).Value), LCase(Me.TextBox1.Value)) 0 Or _
InStr(1, LCase(wsZ.Cells(Zeile, 9).Value), LCase(Me.TextBox1.Value)) 0 Then
Me.ListBox1.AddItem wsZ.Cells(Zeile, 1)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) = Zeile
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 2) = wsZ.Cells(Zeile, 3)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 3) = wsZ.Cells(Zeile, 4)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 4) = wsZ.Cells(Zeile, 5)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 5) = wsZ.Cells(Zeile, 6)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 6) = wsZ.Cells(Zeile, 7)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 7) = wsZ.Cells(Zeile, 8)
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 8) = wsZ.Cells(Zeile, 9)
End If
End If
Next Zeile
End Sub