Gruppe
Dialog
Problem
Ein Suchbegriff aus einer UserForm-TextBox soll in Spalte A gesucht und die Fundstelle ausgewählt werden.
ClassModule: frmSearch
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdSearch_Click()
Dim rng As Range
If txtSearch.Text = "" Then
Beep
MsgBox "Bitte Suchbegriff eingeben!"
txtSearch.SetFocus
Exit Sub
End If
Set rng = Columns(1).Find( _
What:=txtSearch.Text, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If rng Is Nothing Then
Beep
MsgBox "Suchbegriff wurde nicht gefunden!"
Exit Sub
End If
rng.Select
End Sub
StandardModule: Modul1
Sub CallForm()
frmSearch.Show
End Sub