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