Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Action on error

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Action on error

Frank:

Hi. Thanks for the reply.

I've tried it, but I get an error 91 on the set
statement. Do you know what I might be doing wrong?

Thanks,
Mike.


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

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excell copy action pauses for 15 second for the smallest action Meekal Excel Discussion (Misc queries) 1 January 28th 10 04:30 PM
Action button Davey Excel Discussion (Misc queries) 1 October 27th 09 10:49 AM
Allow no action to be taken Smitty[_2_] Excel Worksheet Functions 4 January 23rd 08 10:52 PM
what is OLE.action Flute Excel Discussion (Misc queries) 1 December 2nd 04 09:04 PM
Error msg "Microsoft Excel is waiting for another application to complete an OLE action" JimPNicholls Excel Programming 0 January 16th 04 12:41 PM


All times are GMT +1. The time now is 04:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"