fehlermeldung bei suche
09.12.2005 18:47:32
daniel
hallo hajo...
...habe das ding mal angeschaut. funzt gang gut als button in der oberen Menuleiste.
als ich dann den code aus dem Modul an mein Button in der Tabelle angehaengt habe, schien auch alles erst zu funktionieren.
aber, wenn ich bei einem Treffer weitersuchen lassen, gibt er eine Fehlermeldung.
Private Sub CommandButton9_Click()
Dim wks As Worksheet
Dim rng As Range
Dim strAddress As String, strFind As String
strFind = InputBox("Bitte Suchbegriff eingeben:", Application.UserName, strSuch)
If strFind = "" Then Exit Sub
For Each wks In Worksheets
Set rng = wks.Cells.Find(strFind, lookat:=xlPart, LookIn:=xlFormulas)
If Not rng Is Nothing Then
strAddress = rng.Address
Do
Application.Goto rng, False
If MsgBox("Weiter", vbYesNo + vbQuestion) = vbNo Then Exit Sub
Set rng = Cells.FindNext(After:=ActiveCell)
If rng.Address = strAddress Then Exit Do 'HIER MECKERT DAS PROGRAMM ?
Loop
End If
Next wks
strSuch = strFind
MsgBox "Keine weiteren Fundstellen!", False, Application.UserName
Worksheets(1).Activate
Range("A1").Select
End Sub
...wer kann mir helfen?
gruss
daniel