Hey Guys,
I have a dynamic named range called "Test1" which contains a list of headers for a table am trying to create through macro. Am able to assign the dynamic range to the array named "dynArr" but just getting stuck at a point where am trying to get the upper bound of the array. My code works fine if I replace
For i = 1 To UBound(dynArr)
with
For i = 1 To 12 ' which is the count of the filled rows in the column
Following is my code.
Dim dynArr As Variant
Sub RangeToArray()
ReDim dynArr(Range("Test1").Count)
Set dynArr = Range("Test1")
For i = 1 To UBound(dynArr) '==> Getting Type Mismatch here..
MsgBox "Elements : " & Range("Test1")(i).Address & Chr(13) & dynArr(i)
Next i
End Sub
Please show me some light..
Bookmarks