MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Stop a sub procedure that calls other procedures & funtions...VBA'ers


Posted by Paul on July 06, 2001 8:01 AM

I have a sub procedure that makes a few calls to other procudures to validate data. How do I make the procedure making the call stop? For example, I call a procedure that checks to make sure data has been entered in a textbox. My message displays requesting data, but the calling procedure continues. Thanks for helping.


Posted by faster on July 06, 2001 8:29 AM

try EXIT SUB

Posted by Ron on July 06, 2001 10:13 AM

Exit Sub won't quite do it.

Exit Sub will stop the procedure called. But the calling procedure keeps running.

Posted by faster on July 06, 2001 10:34 AM

Re: Exit Sub won't quite do it.

if textbox = "" then
call sub
else
exit sub
endif

Posted by Ron on July 06, 2001 11:38 AM

Maybe I should rephrase the question.....

I have a procedure that validates data entry for a text box. I call that procedure numerous times to validate many different text boxes. When I find a bad entry I want the whole program to stop and place the focus on that text box. The Exit Sub is stopping the procedure that does the validating, but the sub's that call it continue. I need to stop everything.