Hi Everyone,

I have a question on moving from Sub-procedures back to the main macro.

I have a database/dashboard with a Userform to manage data entry. Many of the userform fields have exclusion criteria. I.e. A message box would appear if you entered an insurance company but also checked "no insurance" to tell the user they have to choose one or the other and then exiting the sub (but not the userform) so they can make the correction.

Because this userform has 7 periods of followup after a clients intake, I had to breakdown parts of the code into sub-procedures because I received the "Procedure Too Large" error.

The problem I have is that message box exclusion criteria within the sub-procedures exits the entire userform (not allowing the user to make the correction). The message box will show correctly, but upon exiting that message box, the whole userform closes too.

Is there a way to use the "Exit Sub" after a message box in a sub-procedure and return to the larger macro without the userform closing?


'Userform Save Changes Button Behavior

Private Sub commandbutton1_click()


'[Bunch of Initial Code for Static Fields on Userform]

'Calling these subs in this way is meant to avoid the error "Procedure Too Large" which was received when running the full code under one sub.

Call Month1
Call Month2
Call Month4
Call Month5
Call Month9
Call Month18
Call Month24

'[Bunch of Code after the call of procedures]

End Sub
Thanks in advance!