Code that stops code running

TomPC

Board Regular
Joined
Oct 13, 2011
Messages
95
Good afternoon, Fellow Excellitrons

Excel 2007 / XP o/s

Please read this carefully as the answer is not Escape, CTRL+Break, Stop or Exit Sub! :)

Does anyone know of some code that can halt the execution of any further code?

Here's a theoretical example

Code:
Sub Run
Call RunAgain
MsgBox("You have been cursed")
End Sub
 
Sub RunAgain
If [MyWish].Value = "Curse me not" Then ????????
'Some other stuff
End Sub

Obviously an "Exit Sub" where the question marks are would just return to the Run sub and the evil curse. What command would make it stop and stop good?

EverSoThanks in advance,

Tom
 

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.
Lol. That takes me back to my Commodore Vic20! I'd completely forgotten the word!

Thanks

Tom:LOL:
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,832
Messages
6,127,152
Members
449,366
Latest member
reidel

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