On error goto

auto

Board Regular
Joined
May 20, 2012
Messages
53
how can i make in vba that if an error is in one line of a statement then skip to the third line and resume? i tried sevrel options but i get an error
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Code:
Sub x()
    Dim d As Double
    
    On Error GoTo Oops
    d = 1 / 0
    d = d * 2
Line3:
    MsgBox "And here we are ..."
    Exit Sub
    
Oops:
    Resume Line3
End Sub
 
Upvote 0
ok, the problem was, that i created 4 labels the first label worked well, but all other labels didnt work, the problem is you cant set more than one "on error goto" into one precidure, so what i did is, i made in the begining the on error goto and there i repeated the steps what it should be done when there is no error,
but anyhow if some1 know from a way how we can call on error goto more then one time in one procedure, please be kind and share
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,490
Members
448,967
Latest member
visheshkotha

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