Trap a find error
strSearchColumn = "I:I"
strTarget = "0"
Set rngFind = Range(strSearchColumn).Find(strTarget,
SearchDirection:=xlPrevious)
If rngFind Is Nothing Then
MsgBox "Not Found"
Else
strLastDeleteRow = rngFind.Row
End If
HTH
"quartz" wrote:
I have the following code. How can I most efficiently exit the function if no
target string is found?
strSearchColumn = "I:I"
strTarget = "0"
Set rngFind = Range(strSearchColumn).Find(strTarget,
SearchDirection:=xlPrevious)
strLastDeleteRow = rngFind.Row
Thanks in advance.
|