Thymen
05-02-2006, 01:30 AM
Hi folks;
anyone able to tell me how I can load a (named) range into a matrix, without loading each element one at a time? If I run someting like:
Option Explicit
Option Base 1
Private myMatrix As Variant
Private Sub UserForm_Initialize()
myMatrix = Range("TestRange")
MsgBox UBound(myMatrix)
MsgBox LBound(myMatrix)
MsgBox myMatrix(5)
End Sub
with TestRange a named range, it shows correct UBound, but I get a 'Subscript out of range" when I want to show a matrix value..:banghead:
I am obviously missing something... but what?:dunno
Thymen
anyone able to tell me how I can load a (named) range into a matrix, without loading each element one at a time? If I run someting like:
Option Explicit
Option Base 1
Private myMatrix As Variant
Private Sub UserForm_Initialize()
myMatrix = Range("TestRange")
MsgBox UBound(myMatrix)
MsgBox LBound(myMatrix)
MsgBox myMatrix(5)
End Sub
with TestRange a named range, it shows correct UBound, but I get a 'Subscript out of range" when I want to show a matrix value..:banghead:
I am obviously missing something... but what?:dunno
Thymen