Sub...End Sub Statement

<< Click to Display Table of Contents >>

Navigation:  Control Commands >

Sub...End Sub Statement

Description

Executes a series of statements within the body of the Sub procedure.

Syntax

Sub name [ (parameter) ]
    [statements]
End Sub

 

The Sub...End Sub statement syntax has these parts:

 

Part

Description

name

Name of the Sub; follows standard variable naming conventions..

statements

Any group of statements to be executed within the body of the Sub procedure.

parameter

Optional. Variable name representing the parameters of this procedure. Added version 5.21

Remarks

If condition is True, all statements in statements are executed until the Wend statement is encountered. Control then returns to the While statement and condition is again checked. If condition is still True, the process is repeated. If it is not True, execution resumes with the statement following the Wend statement.

While...Wend loops can be nested to any level. Each Wend matches the most recent While.