ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Action on Error (https://www.excelbanter.com/excel-programming/292847-action-error.html)

No Name

Action on Error
 
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



Chip Pearson

Action on Error
 
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


wrote in message
...
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

Action on Error
 
Thanks Chip and Frank! I understand this now.

Mike.

-----Original Message-----
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


wrote in message
...
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




.



All times are GMT +1. The time now is 03:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com