Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

exit end

ResolvedVersion 2007

Bethan has attended:
Excel VBA Intro Intermediate course
Access Intermediate course

Exit or End?

When would I use Exit Sub not End Sub?

RE: Exit or End?

Hi Bethan, thanks for the query. Exit Sub stops the procedure where it currently is. You normally use this when you've still got some following code *within the procedure* e.g. your error handler, or any code that has been labelled. The End Sub statement indicates the end of the code for that procedure as a whole. You always need an End Sub at the end of the procedure, and you use Exit Sub to stop the code running at a particular point other than the literal end of the code. A bit complicated but important nonetheless!

Hope this helps,

Anthony

Wed 16 Dec 2009: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Working with 3D formulas

You can only use fill-down if you remove $ for Absolute References.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.