Declaring array and setting bounds
Sub MyTestArray()
Dim myArray(1 To 4) As String ' Declaring array and setting bounds
Dim Response As String
Dim i As Integer
Dim myFlag As Boolean
myFlag = False
myArray(1) = "A"
myArray(2) = "B"
myArray(3) = "C"
myArray(4) = "D"
Do Until myFlag = True
Response = InputBox("Please enter your choice: (i.e. A,B,C or D)")
For i = 1 To 4
If UCase(Response) = UCase(myArray(i)) Then
myFlag = True: Exit For
End If
Next i
Loop
End Sub
Related examples in the same category