Function Statement

  1. Function Fname [(Arguments)] [As type]

    1. [statements]

      Functionname = expression

      [statements]

      Functionname = expression

    End Function

Declares and defines a procedure that can receive arguments and return a value of a specified data type.

When the optional argument list needs to be passed the format is as follows:

  1. ([ByVal] variable [As type] [,ByVal] variable [As type] ]…])

The optional ByVal parameter specifies that the variable is [passed by value instead of by reference. For details, see the help topic "ByRef andByVal" in this manual. The optional As type parameter is used to specify the data type. Valid types are String, Integer, Double, Long, and Varaint (see "Variable Types" in this manual).

Related Topics:

Dim

End

Exit

Sub

More:

Example - Function Statement