See Also Example
Description
Selects and returns a value from a list of arguments.
Syntax
Choose( indexnum, varexpr [,varexpr ] . . .)
Remarks
The Choose function uses the following parts:
Part Description
indexnum Numeric expression or field that results in a value between 1 and the number of varexpr expressions following indexnum.
varexpr Variant expression . You can include a maximum of 13 expressions.
You can use Choose to look up one value in a list of possibilities. For example, if indexnum evaluates to 3 and the varexpr list is "one," "two," "three," then Choose returns "three." This is particularly useful if indexnum represents the value in an option group.
Choose returns the varexpr determined by the value of indexnum. If indexnum is 1, Choose returns the first varexpr; if indexnum is 2, it returns the second, and so on.
Choose evaluates every varexpr, even though it returns only one. For this reason, you should watch for undesirable side effects. For example, don't have a MsgBox function in each varexpr because they will all be displayed.
The Choose function returns a Null
Following the rules for the Fix function, indexnum is rounded to the nearest whole number.