HelloLloyd
Technical User
I am trying to set a range as an array, and the UBound keeps returning a value of 1. Below is the code...
Sub TestArray()
Dim testarray As Variant
testarray = Range("g128:dv128"
Box = UBound(testarray)
counter = 1
While counter <= UBound(testarray)
MsgBox testarray(counter, 1)
counter = counter + 1
Wend
End Sub
This code works fine when the range is horizontal, but not vertical like it's coded now. It keeps telling me that the upper bound of the array is 1. I'm sure this is something I'm missing. I'm new to this and learning as I go. Thanks for any help.
Sub TestArray()
Dim testarray As Variant
testarray = Range("g128:dv128"
Box = UBound(testarray)
counter = 1
While counter <= UBound(testarray)
MsgBox testarray(counter, 1)
counter = counter + 1
Wend
End Sub
This code works fine when the range is horizontal, but not vertical like it's coded now. It keeps telling me that the upper bound of the array is 1. I'm sure this is something I'm missing. I'm new to this and learning as I go. Thanks for any help.