Macro Sheets Only
Describes the arguments used in a custom function, which is a type of macro, or in a subroutine. A custom function or subroutine must contain one ARGUMENT function for each argument in the macro itself. There are two forms of the ARGUMENT function. In the first form, only name_text is required; in the second form, only reference is required. Use the first form if you want to store the argument as a name. Use the second form if you want to store the argument in a specific cell or cells.
Syntax 1
For name storage
ARGUMENT(name_text, data_type_num)
Syntax 2
For cell storage
ARGUMENT(name_text, data_type_num, reference)
Name_text is the name of the argument or of the cells containing the argument. Name_text is required if you omit reference.
Data_type_num is a number that determines what type of values Microsoft Excel accepts for the argument. The following table lists the possible data types.
Data_type_num Type of value
1 Number
2 Text
4 Logical
8 Reference
16 Error
64 Array
Reference is the cell or cells in which you want to store the argument's value.
Remarks
Examples
To create a custom function that calculates profit, use the following functions to specify arguments for cost, sales, and sales volume:
ARGUMENT("UnitsSold", 1) ARGUMENT("UnitCost", 1) ARGUMENT("UnitPrice", 1)
Related Function
RESULT Specifies the data type a custom function returns
VOLATILE Makes custom functions recalculate automatically
List of Control Functions