On Error Goto -1

confusion123

Active Member
Joined
Jul 27, 2014
Messages
400
My error handling tends to be as follows:

Code:
On Error Goto Errhandler

     ' some code

Continuation:

    On Error Goto 0

Exit Sub

Errhandler:

    ' do something

    Resume Continuation

End Sub

Is the above good practice?

I assume putting On Error Goto 0, "switches off" error handling.

But I've come across (though rarely):

Code:
On Error Goto -1

when is that used?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Read Rory's nice explanation Here

@RoryA:

This line still kills me: I'm not actually this blurry in real life unless you're drinking with me.

I just LMAO each time.

Mark
 
Last edited:
Upvote 0
@Mark,

It's funny because it's true. ;)
 
Upvote 0
Not likely, but if I was ever to suddenly have tons o' funds and made it to East Sussex... (y)
 
Upvote 0
You'd be most welcome!
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,245
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top