Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trap a find error
I have the following code. How can I most efficiently exit the function if no
target string is found? strSearchColumn = "I:I" strTarget = "0" Set rngFind = Range(strSearchColumn).Find(strTarget, SearchDirection:=xlPrevious) strLastDeleteRow = rngFind.Row Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trap a find error
strSearchColumn = "I:I"
strTarget = "0" Set rngFind = Range(strSearchColumn).Find(strTarget, SearchDirection:=xlPrevious) If rngFind Is Nothing Then MsgBox "Not Found" Else strLastDeleteRow = rngFind.Row End If HTH "quartz" wrote: I have the following code. How can I most efficiently exit the function if no target string is found? strSearchColumn = "I:I" strTarget = "0" Set rngFind = Range(strSearchColumn).Find(strTarget, SearchDirection:=xlPrevious) strLastDeleteRow = rngFind.Row Thanks in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trap a find error
Thanks Jim, works great!
"Jim Thomlinson" wrote: strSearchColumn = "I:I" strTarget = "0" Set rngFind = Range(strSearchColumn).Find(strTarget, SearchDirection:=xlPrevious) If rngFind Is Nothing Then MsgBox "Not Found" Else strLastDeleteRow = rngFind.Row End If HTH "quartz" wrote: I have the following code. How can I most efficiently exit the function if no target string is found? strSearchColumn = "I:I" strTarget = "0" Set rngFind = Range(strSearchColumn).Find(strTarget, SearchDirection:=xlPrevious) strLastDeleteRow = rngFind.Row Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to error trap "... cannot find the data..." message? | Excel Discussion (Misc queries) | |||
Error Trap Not Working | Excel Programming | |||
Trap a DateValue Error | Excel Programming | |||
error trap | Excel Programming |