Search notes:

VBA: User defined subs and functions

optional parameters
returning values
byVal / byRef
This page discusses if parentheses are required or not allowed when calling a function/sub

Returning from functions

Although there seems to be a return statement in VBA (in order to return to a goto), the way to return from a function is to use exit function.
Exiting a sub or function (exit sub, exit function, end sub, end function) clears the err object.

Names

Underscores in a sub or function name have a special meaning: they indicate event procedures/functions.

Dynamically calling subs

VBA allows to call functions and methods whose names are stored in a variable, see application.run and callByName.

Declaring non-procedures or functions after a procedure or function

In the source code, after the first procedure or function was declared, it is not possible to declare variables or types. The corresponding error message is * Only comments may appear after End Sub, End Function, or End Property.*

Error: Procecdure too large

Apparently, the maximum size of a VBA sub or function is 64 KB. I mean… really?

See also

The call statement
Function/sub parameters
property set and get functions.
Subs and functions can be described with the VB_Description attribute.
Passing arrays to functions.
Using paramArray to pass an arbitrary number of arguments to a function.
A sub or function runs under a specific error handling policy.
In Excel, application.onTime can be used to schedule the execution of a procedure.
Also in Excel, using the special statement application.volatile, a function, whose return value is used on a worksheet, can be marked as volatile which affects when the function is called for formula recalculation.
In Access, a sub or function can be executed with Application.Run.

Index