ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I exit a macro subroutine? (https://www.excelbanter.com/excel-worksheet-functions/65241-how-do-i-exit-macro-subroutine.html)

John

How do I exit a macro subroutine?
 
I test some conditions in my macro, and if certain things are wrong, I
display a msgbox and then want to terminate the macro. I tried a "Return"
statement, but this get me a code error. What is the secret VBA subroutine
exit command besides running out the end of the subroutine?

Gary''s Student

How do I exit a macro subroutine?
 
Exit Sub:


See Exit Statement in VBA Help
--
Gary's Student


"John" wrote:

I test some conditions in my macro, and if certain things are wrong, I
display a msgbox and then want to terminate the macro. I tried a "Return"
statement, but this get me a code error. What is the secret VBA subroutine
exit command besides running out the end of the subroutine?



All times are GMT +1. The time now is 07:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com