What is the syntax to use a Go Sub Return statement?

Go Sub <procedure name>
     <your code here>
Exit Sub

<procedure name>:
     <your code here>
Return
‘example
usersName = InputBox(“Please enter your name.”) ‘1. user must type in his/her name
If usersName=”” Then GoSub NoName ‘2. if user doesn’t give a name, computer goes to sub procedure NoName
Exit Sub ‘5. Put exit sub so it will not run NoName unnecessarily

NoName: ‘3. This procedure is run only if user leaves inputbox blank
     MsgBox (“You did not enter any name”)
Return ‘4. returns to line procedure
Advertisements