Exit sub, end and stop [what are the differences of this lines...]

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi, Exit sub, end and stop [what are the differences of this lines...]
Do they do the same thing?:)

Thanks
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
They certainly don't do the same thing...

Exit Sub (or Exit Function) will immediately exit from the sub or function it is in. If that sub or function was called from other code, the program will continue in that other code, right after the call to the sub or function you just left...

End will also exit from any sub or function, but it will not return to any calling sub or function. This will effectively stop all macro execution and return full control to the user.

Stop is used in a debugging phase of your macro's. At any place you put a Stop, the code will be interrupted, with the debugger highlighting that line, after which you can continue debugging with stepping through code etc...
 
Upvote 0
Hermanito, thanks for your advice.

Thanks alot!:)

They certainly don't do the same thing...

Exit Sub (or Exit Function) will immediately exit from the sub or function it is in. If that sub or function was called from other code, the program will continue in that other code, right after the call to the sub or function you just left...

End will also exit from any sub or function, but it will not return to any calling sub or function. This will effectively stop all macro execution and return full control to the user.

Stop is used in a debugging phase of your macro's. At any place you put a Stop, the code will be interrupted, with the debugger highlighting that line, after which you can continue debugging with stepping through code etc...
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

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