Label not defined

richarddawson

Board Regular
Joined
Oct 18, 2014
Messages
95
I am getting this message frequently - a rather simple example is

Sub newSub()
On Error GoTo SRTT
J = 3 / 0
End Sub
SRTT:
Stop
End Sub

I have even reloaded Office 365
Can any one help, please?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Why do you have End Sub half way through the code and at the end.

Perhaps you mean Exit Sub?
 
Upvote 0
Hi,

I believe you can not have two "end sub", you should use "exit sub" when you want to stop it in the middle
 
Upvote 0
Thank you both so much. Your solutions do, of course, work.

Just a very silly mental block on my part. I have spent over two hours on it. I have used "exit sub" many times in the past.

Richard
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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