ich bastel mir gerade ne Suchfunktion und bin soweit auch fertig, zumindest das ich die Adressen in ner Msgbox ausgegeben bekomme.
Private Sub CommandButton1_Click()
Dim TextBox2 As String
Dim WS As Worksheet: Set WS = ActiveSheet
Dim aSh As Worksheet
Dim sfErg As Range
Dim lastrow As Long
If TextBox1 = "" Then
MsgBox "Bitte Suchbegriff eingeben!"
Else
eingabe = TextBox1.Value
lastrow = WS.UsedRange.Rows(WS.UsedRange.Rows.Count).Row
On Error Resume Next
With WS.Range("A:A")
Set sfErg = .Find(eingabe) ', , xlValues, xlWhole, xlByRows
Do: If MsgBox("" & eingabe & " wurde gefunden in Zelle: " & sfErg.Address(0, 0), _
vbInformation + vbOKCancel, _
"Wert wurde gefunden in: ") = vbCancel _
Then Exit Do
Set sfErg = .FindNext(sfErg)
firstAddress = sfErg.Address
Loop While Not sfErg Is Nothing
End With
Set aSh = Nothing: Set sfErg = Nothing
End If
End Sub
Mein Problem: Er er hört nicht beim letzten Treffer auf habe es schon versucht mit lastrow allerdings fängt er bei mir wieder vorne an mache da wohl was falsch =(
Desweiteren ist es möglich die ergebnisse in Spalte D fortlaufend einzutragen? Bekomme sie zurzeit nur in ner msgbox und sobald ich ne Adresse zum schreiben dazu packe kommt Error :(
Vielen dank schonmal !:)