AW: Variable aus Form übernehmen und in sheet suchen
20.10.2012 15:31:16
fcs
Hallo Michael,
im funktioniert es wie folgt.
Zum Starten der suche muss du dann noch eine Schaltfläche im Formular einfügen.
Für die Schältfläche fügst du dann den folgenden Code ein.
Namen von Textbox und Schaltfläche muss du ggf. anpassen.
Für eine Suche in "Ganzer Zelle" muss du xlPart durch xlWhole ersetzen.
Gruß
Franz
Private Sub CommandButton1_Click()
Dim varSuche, Zelle As Range
Dim wks As Worksheet
varSuche = Me.TextBox1
Set wks = ActiveSheet
With wks.Cells
Set Zelle = .Find(What:=varSuche, after:=ActiveCell, LookIn:=xlValues, _
lookat:=xlPart, _
searchorder:=xlByRows, searchdirection:=xlNext)
End With
If Zelle Is Nothing Then
MsgBox "Suchbegriff nicht gefunden"
Else
Zelle.Select
End If
End Sub