Action on Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Frank:

Thank for your help. I tried this, but I receive an
error 91 on the Set statement. Any ideas what I might be
doing wrong?

Thanks,
Mike.

p.s. There is something wrong with the posting ... I
cannot find the previous posting unless I do a search.

-------------------
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
 
Mike,

The Find method returns a Range type object, which you can either
Set to the variable OFound, or use with Activate. You can't do
both. Get rid of the Activate method at the end of that line of
code:

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


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top