Thread: Action on error
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Action on error

Hi Mike
try

Set OFound = Cells.Find(What:=mydate, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate

If Not oFound Is Nothing Then
oFound.activate
else
msgbox "not found"
End If



--
Regards
Frank Kabel
Frankfurt, Germany

Mike wrote:
Hi.

The following code line searches for a value. When it
finds the value, further code will peform some other
actions.

My problem is when the string is not found. Is there a
way to use a conditional statement if the value is not
found?

Thanks,
Mike.

Cells.Find(What:=mydate, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate