Suchstring nicht gefunden -> Meldefenster
26.01.2010 11:14:16
Timothy
Hallo,
habe ein kleines Problem mit der Ausgabe einer Fehlermeldung:
Dim Row4 As Long
Dim Col4 As Integer
Dim SuchStr4, PathFeedStr4 As String
SuchStr4 = "Pfad für \ww4\mprmerge.exe" 'Suchbegriff
Col4 = 1 'Suchspalte
Row4 = Cells(Rows.Count, 1).End(xlToRight).Row 'Suchzeile
For Row4 = 1 To Cells(Rows.Count, 1).End(xlToRight).Row
If InStr(Cells(Row4, Col4), SuchStr4) <> 0 Then
'MsgBox SuchStr4 & " gefunden in " & Cells(Row4, Col4).Address
Cells(Cells(Row4, Col4).Row + 1, 1).Activate
PathFeedStr4 = Cells(Cells(Row4, Col4).Row + 1, 1).Value
If PathFeedStr4 = "" Then 'Wenn nichts eingetragen -> Abbruch
MsgBox "Bitte 'Pfad für \ww4\mprmerge.exe' eintragen!"
Exit Sub
End If
'MsgBox PathFeedStr4
Exit For
End If
Next
If InStr(Cells(Row4, Col4), SuchStr4) = 0 Then
MsgBox "" & SuchStr4 & " nicht gefunden." & Chr(13) & Chr(10) & "Bitte überprüfen _
_
ob " & SuchStr4 & " in erster Spalte definiert ist!"
Exit Sub
End If
Ist das Falsch wie ich das Meldefenster ausgeben möchte, wenn der Suchstring nicht gefunden wurde?Bei mir kommt immer "Anwendungsfehler"......
If InStr(Cells(Row4, Col4), SuchStr4) = 0 Then
MsgBox "" & SuchStr4 & " nicht gefunden." & Chr(13) & Chr(10) & "Bitte überprüfen _
_
ob " & SuchStr4 & " in erster Spalte definiert ist!"
Exit Sub
End If
Vielen Dank für eure Hilfe!