Msgbox(suchen/abbrechen)
19.06.2002 15:28:05
WolfgangM
wie muß ich das Makro so umbauen, daß, wenn ich in der MsgBox auf abbrechen klicke, das Makro beendet wird. Mit ja, und nein klappts, nur mit abbrechen nicht da wird weitergesucht.
Sub weitersuchen()
Static rng As Range
Static strAddress As String, strFind As String
strFind = InputBox("Bitte Suchbegriff eingeben:", "Daten suchen", strFind)
Set rng = Cells.Find(strFind, LookAt:=xlPart, LookIn:=xlFormulas)
If strFind = "" Then Exit Sub
If Not rng Is Nothing Then
strAddress = rng.Address
Do
Application.Goto rng, True
If MsgBox("Weitersuchen", vbYesNoCancel + vbQuestion) = vbNo Then Exit Do
Set rng = Cells.FindNext(After:=ACTIVECELL)
If rng.Address = strAddress Then
End If
Loop
End If
If rng Is Nothing Then
Beep
MsgBox "Daten wurden nicht gefunden!"
Exit Sub
End If
rng.Select
Cells(ACTIVECELL.Row, 1).Formula = Date
Cells(ACTIVECELL.Row, 1).Select
End Sub
wer kann mir dabei helfen?
schon mal vielen Dank
Gruß WolfgangM