#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Skip Errors

I'm not sure I like the term "skip errors", I prefer to use "trap errors" and
give an example of how I do it.

Let's say I'm looking for a particular worksheet called 'Barbs Sheet'.

Dim myWS as Worksheet

Set myWS = nothing
on error resume next
Set myWS = Worksheets('Barbs Sheet')
on error goto 0

if myWS is nothing then
'Worksheet not found
else
'Worksheet found
end if

And do your execution from there. I'm in the process of modifying code in
a workbook that has On Error goto (Some grouping of lines), and untangling it
is a challenge, to say the very least.

I don't leave 'On Error Resume Next' on for very long, only long enough to
get through a line that *may* have an error until I can verify I have what I
want.
I find I need to add error trapping as I test, but I'd rather do it that way
than have it run all the way to the end and not know where the problem really
is.

HTH,
Barb Reinhardt
"Elton Law" wrote:

Dear Expert,

Can I set a script at the very beginning of the macro to overrule all errors
it encounter ?

That is ... it would not halt / stop ....
Even face errors ... immediately goto next line ....

A script at the beginning to rule this ....
Just go ahead and skip the error lines and keep on running with next line.

Thanks


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
using IF to skip Julie Excel Worksheet Functions 4 March 14th 08 10:21 PM
skip to next from if John Smith Excel Programming 1 August 8th 07 06:47 AM
skip errors in an average tamiluchi Excel Worksheet Functions 8 September 25th 06 04:05 PM
Excel Throwing Circular Errors When No Errors Exist MDW Excel Worksheet Functions 1 August 10th 06 02:15 PM
Unresolved Errors in IF Statements - Errors do not show in results Markthepain Excel Worksheet Functions 2 December 3rd 04 08:49 AM


All times are GMT +1. The time now is 08:17 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"