Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excell copy action pauses for 15 second for the smallest action | Excel Discussion (Misc queries) | |||
Action button | Excel Discussion (Misc queries) | |||
Allow no action to be taken | Excel Worksheet Functions | |||
what is OLE.action | Excel Discussion (Misc queries) | |||
Error msg "Microsoft Excel is waiting for another application to complete an OLE action" | Excel Programming |