VBA GoTo statement helps code execution to jumps to a specific line within the procedure. In simple words, with the goto statement, VBA jumps to a particular line that is specified by you. For example, if you have specified to jump to the second line go will jump to that line.
- First, you need to use the goto statement.
- After that, you need to define the place where you want to VBA to jump from goto.
- Next, create the tag to create that place in the procedure.
- In the end, add the line(s) of code that you want to get executed.
Syntax:
Sub vba_goto()
GoTo Last Range("A1").Select Last:
Range("A12").Select
End Sub