- Local time
- Today, 05:37
- Joined
- Feb 19, 2002
- Messages
- 46,883
Why? That would make me wrong? It's like not using your hammer because someone once dropped one on their toe and broke their toe. Like any other tool, if you know what it is for and how to use it, it allows you to use the best tool for the situation.I imagine they are right
GoSub's allow you to break up a procedure for readability and in many cases to actually simplify and eliminate deeply nested if's.
How many levels to you nest If's? The answer is - as many levels as the logic dictates. GoSub's help with that.
For COBOL people, If there are any left

I would be interested in why some experts avoid them also. Maybe because they have the word "Go" in them. GoTo in COBOL and other languages is how people create spaghetti code. GoSub is like a call to a sub but the code is within the calling sub so it shares all the variables.
Personally, I HATE having to use GoTo to handle errors. It is the absolute worst thing about VBA.
Last edited: