Multiple On Error Statements

MikeDBMan

Well-known Member
Joined
Nov 10, 2010
Messages
608
I want to put some error checking in my code but I can't seem to figure out how to have multiple "On Error Goto XXX" statements in the same Sub. Someone said to place "Resume" statements in the code but I can't figure out how to make it work. Below are 2 "On Error" statements. The line Sheets("asdf").Select should be skipped because that tab does NOT exist but instead I get an error message. What am I doing wrong? Thanks!

Code:
Sub testit()
On Error GoTo AfterSkipped
 
'blah blah blah  code and more code....
 
Resume AfterSkipped
GoTo AfterSkipped
 
AfterSkipped:
On Error GoTo NextErr
Sheets("asdf").Select
 
NextErr:
End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,214,645
Messages
6,120,711
Members
448,984
Latest member
foxpro

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