Selects and returns a value from a list of arguments.
Public Function Choose( _ ByVal Index As Double, _ ByVal ParamArray Choice() As Object _ ) As Object
The Choose function returns a member of the list passed in Choice(), based on the value of Index. The first member of the list is selected when Index is 1. The last member of the list is selected when Index is UBound(Choice()). If Index is outside these limits, Choose returns Nothing.
If Index is not a whole number, it is rounded to the nearest whole number before it is evaluated.
You can use Choose to look up a value in a list of possibilities.
The expressions in the argument list can include function calls. As part of preparing the argument list for the call to Choose, the Visual Basic compiler calls every function in every expression. This means that you cannot rely on a particular function not being called if a different expression is selected by Index.
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)