ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Skipping sections of code (https://www.excelbanter.com/excel-programming/325523-skipping-sections-code.html)

ExcelMonkey[_190_]

Skipping sections of code
 
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

K Dales[_2_]

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



All times are GMT +1. The time now is 06:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com