exit end

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

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Exit or End?

Exit or End?

resolvedResolved · Low Priority · Version 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:

Creating charts in Excel 2010

Here's how to present your data in a chart format:

Highlight the data you wish to use in a chart

Click the Insert Ribbon

In the Charts Group, select Column Chart

Your chart will then appear on your work sheet.

View all Excel hints and tips


Server loaded in 0.08 secs.