Set Next Statement can only apply to executable lines within current procedure.
You can choose the Set Next Statement command to indicate where a suspended program should begin when execution is continued. This error has the following causes and solutions:
When you chose the command, the cursor was on a line that didn't contain an executable statement. Place the cursor on a line with an executable statement and try again. Declarations, line labels, and comments aren't executable, so lines with only declarations, labels, and comments can't be the targets of the Set Next Statement command.
When you chose the command, the cursor was on a line outside the currently executing procedure.
Place the cursor on a line within the currently executing procedure.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.