Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find generates error 1

Status
Not open for further replies.

rgandy

Technical User
Nov 17, 2005
38
US
Is there a way to get around the fact that if you perform the Find function and the search text is not found, the program generates an error? i am attempting
If IsError(range(CurrentHeaderRange).Find(RORS1Text).Column) = False Then
but it is not working because the error msg still appears when the text is not found

alternatively, to turn error msgs off
On Error Resume Next
what turns them back on?
 
what turns them back on?
On Error GoTo 0

You may try something like this:
Set myRange = CurrentHeaderRange.Find(RORS1Text)
If Not myRange Is Nothing Then


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
->what turns them back on?

on error goto 0
(that's a zero)

[tt]_____
[blue]-John[/blue][/tt]

Help us help you. Please read FAQ181-2886 before posting.
 
If you trap the error you may be able to do something about it.

on error resume next
err.clear
range(CurrentHeaderRange).Find(RORS1Text).Column)
if err <> 0 then
MsgBox "The value/string was not found"
Err.clear
GoTo NotFound
End if
code if value/string was found

NotFound:

End Sub

Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top