On...GoSub Statement

CategoryFlow Control Features
AvailabilityVB:Yes, VBA:Yes, VBScript:No
PurposeBranches to one or more code sections based on an expression.
Typical SyntaxOn expression GoSub destinationlist
See AlsoChoose Function, GoSub Statement, GoTo Statement, IIf Function, On...GoTo Statement, Resume Statement, Select Case Statement

Do not use the On...GoSub statement within your Visual Basic source code. Usage of this statement can result in subtle errors, maintenance difficulties, and debugging nightmares. Use a Select Case statement instead to redirect your procedure based on an expression value.

On...GoTo Statement

CategoryFlow Control Features
AvailabilityVB:Yes, VBA:Yes, VBScript:No
PurposeBranches to one or more code sections based ...

Get Visual Basic® Style Guide, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.