Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error Trapping
I'm looping through a list searching for a word that may or may not be in the
list. I use 'on error goto' to take action if a word can't be found in the list and then want to continue searching for the next word(s). I get an error (not sure of exact wording) and can't continue - any ideas. It seems it is not just a result of searching, I'm pretty sure it's whenever you try to continue running code after a error has been trapped. It is not as easy as using the return keyword. Thanks in advance. -- Andrew |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error Trapping
what is your list? is it a table in a spreadsheet?
if it IS then you can use the FIND method of a range dim source as range ' table of data dim found as range ' found cell from find dim what as string ' text to search for dim firstadd as striing ' address of the first found cell what = "something" set source = worksheets("main").Range("mydata") set found = source.find(what) if not found is nothing then firstadd = found.address Do ' process found set found = source.find(found) Loop until found.address = firstadd end if this is a pretty standard loop --- much like the one in Help. If you are not searching for your text this way, then please explain more clearly. "Andrew" wrote: I'm looping through a list searching for a word that may or may not be in the list. I use 'on error goto' to take action if a word can't be found in the list and then want to continue searching for the next word(s). I get an error (not sure of exact wording) and can't continue - any ideas. It seems it is not just a result of searching, I'm pretty sure it's whenever you try to continue running code after a error has been trapped. It is not as easy as using the return keyword. Thanks in advance. -- Andrew |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error Trapping | Excel Discussion (Misc queries) | |||
Error Trapping from WSH | Excel Discussion (Misc queries) | |||
error trapping | Excel Programming | |||
Error trapping | Excel Programming | |||
error trapping | Excel Programming |