View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Skipping sections of code

It is really poor practice to use, but VBA still includes the good ol' Goto
statement. The following will only print "Starting...":

Public Sub GotoTest()

Debug.print "Starting..."
Goto SkipEnd
Debug.print "Ending."

SkipEnd:

End Sub

This would be OK while you test your code, and it does work, but it is not
good practice to use it normally.

"ExcelMonkey" wrote:

I have a long run of code (not modular). Is it possible
to set breaks on a particular section of code (begin and
end break) so that it will not run when the macro is
running? Or is the only way to do this on non modular
code to comment out the sections of code?

THanks