BIGTONE559
Active Member
- Joined
- Apr 20, 2011
- Messages
- 336
Greetings,
I'm trying to learn how to work with arrays. in this sample that i wrote i keep receiving an error at the "Msgbox MyArray(i)" line. the goal is to have the msgbox cycle through all of the values in the array. the error is "Subscript out of Range"
All help is appreciated.
I'm trying to learn how to work with arrays. in this sample that i wrote i keep receiving an error at the "Msgbox MyArray(i)" line. the goal is to have the msgbox cycle through all of the values in the array. the error is "Subscript out of Range"
Code:
Sub Sample()
Dim i As Integer
Dim MyArray() As Variant
MyArray = Range("MyDates")
For i = 1 To UBound(MyArray)
MsgBox MyArray(i)
Next i
End Sub