Exit Statement (Visual Basic)
Exits a procedure or block and transfers control immediately to the statement following the procedure call or the block definition.
In the following example, the loop condition stops the loop when the index variable is greater than 100. The If statement in the loop, however, causes the Exit Do statement to stop the loop when the index variable is greater than 10.
The following example assigns the return value to the function name myFunction, and then uses Exit Function to return from the function.
The following example uses the Return Statement (Visual Basic) to assign the return value and exit the function.