View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_5_] Jim Thomlinson[_5_] is offline
external usenet poster
 
Posts: 486
Default Error Handling - On Error GoTo doesn't trap error successfully

From your description of the problem you should be handling the #N/A in the
normal flow of execution, not an errorhandler (IMO). If you can reasonably
expect a problem it is not an error. It seems to me that with

if not isnumeric('whatever you are looking at') then

Could avoid throwing the error in the first place.

That being said, you can not catch an error within an error handler, so if
an error is being thrown while you are in the errorhandler then you need to
rethink your error handler. To clear an error use...

err.clear

If you need more help you will have to post some code.
--
HTH...

Jim Thomlinson


"David" wrote:

When you use the "On Error GoTo" approach to trap an error, is it
necessary to "clear out" the error in some way before a later instance
of the same type of error can be trapped?

I have a program that loops through an excel table, and the error
handling seems to work the first time bad data is encountered (in this
case, when the cell has a string "N/A" rather than the expected
currency data type) but then when it hits a second instance of the same
error (Run TIme Error '13' Type Mismatch) it stops dead in its tracks.

Any suggestions?