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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Lol. That takes me back to my Commodore Vic20! I'd completely forgotten the word!

Thanks

Tom:laugh:
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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