2003-ExcelVBA::function-parameter-definition
Excel VBA function parameter definition
No | Item | Content |
---|---|---|
1 | Optional | "Every optional parameter in the procedure definition must specify a default value. The default value for an optional prameter must be a constant expression. Every parameter following an optional parameter in the procedure definiton must also be optional." |
2 | ByVal | By Value |
3 | ByRef | By Reference |
4 | PararmArray | A parameter array can be used to pass an array of arguments to a procedure. You don't have to know the number of elements int the array when you define the procedure. |
5 | varname | Variable parameter name |
6 | type | type |
7 | defaultValue | default value if it is missing |
Code sample
result on immediate window
run ----- Try Code start--------------! 1 2 3 4 5 ----- Try Code -------------- end!