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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

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