Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 358
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default 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
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
Error Trapping gazza67[_2_] Excel Discussion (Misc queries) 2 September 6th 07 06:11 PM
Error Trapping from WSH Tom Chau Excel Discussion (Misc queries) 1 August 25th 06 04:21 AM
error trapping [email protected] Excel Programming 2 January 20th 05 10:07 PM
Error trapping Luis Excel Programming 1 November 11th 04 03:25 AM
error trapping libby Excel Programming 5 November 25th 03 10:57 PM


All times are GMT +1. The time now is 08:30 PM.

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"