The VBA Choose function returns a value from its argument list with a given number.
Choose(number, value_1, value_2, value_3, etc.)
Display of one of 3 values by the number written in the "choice" variable:
Sub ChooseExample1()
choice = 1
course = Choose(choice, "Excel", "VBA", "Google Sheets")
MsgBox "Selected course: " & course 'Returns the message: "Selected course: Excel"
End Sub
An alternative to the Choose function is to use an array (Array):
Sub ChooseExample2()
choice = 1
course = Array("Excel", "VBA", "Google Sheets"))(choice)
MsgBox "Selected course: " & course 'Returns the message: "Selected course: VBA"
End Sub