Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "On Error Resume Next" Question

when you put this line in the code, does it act for only
the next line or all lines after. If for the latter,is
there a reverse of the statement to stop it?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default "On Error Resume Next" Question

Note: "all lines after" for the current procedure. If sub2 was
called from sub1, then exiting sub2 and returning to sub1 resets the
error handler to sub1's, or the default.

For instance:

Public Sub Sub1()
On Error GoTo A
Sub2
Err.Raise 1
Exit Sub
A:
MsgBox "A"
On Error GoTo 0
End Sub

Public Sub Sub2()
On Error GoTo B
Sub3
Err.Raise 2
Exit Sub
B:
MsgBox "B"
End Sub

Public Sub Sub3()
On Error GoTo C
Err.Raise 3
Exit Sub
C:
MsgBox "C"
On Error GoTo 0
End Sub

The On Error GoTo 0 in Sub3 doesn't affect Sub2's call to B:, and
Sub1's call to A: is not affected by sub2's call to B:.

In article ,
"Phobos" wrote:

"Jim" wrote in message
...
when you put this line in the code, does it act for only
the next line or all lines after.


All lines after.

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
"Document not saved" "error in loading DLL" Tracey L Excel Discussion (Misc queries) 0 December 1st 08 12:57 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Question on "On Error GoTo skip" dan Excel Discussion (Misc queries) 2 July 1st 07 10:48 PM
"Disk is Full" add-on question to "Can't reset last cell" post tod [email protected] Excel Discussion (Misc queries) 0 January 22nd 07 02:32 AM
Shortcut key for "Paste Options" and "Error Checking" buttons? johndog Excel Discussion (Misc queries) 1 October 6th 06 11:56 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"