C
Charley Kyd
If Test is defined as a contiguous three-cell column, this macro works:
Sub Foo()
Dim rngTest As Range, saTest() As String
Set rngTest = ThisWorkbook.Names("Test").RefersToRange
ReDim saTest(1 To 3, 1)
saTest(1, 1) = "a"
saTest(2, 1) = "b"
saTest(3, 1) = "c"
rngTest = saTest
End Sub
The nice thing about this approach is that we can very quickly write data to
the spreadsheet, and without looping.
However, what if we want to go in the other direction? This statement fails:
saTest = rngTest
So, can anyone suggest a way to load an array with values from a
range--without looping?
Thanks.
Charley
Sub Foo()
Dim rngTest As Range, saTest() As String
Set rngTest = ThisWorkbook.Names("Test").RefersToRange
ReDim saTest(1 To 3, 1)
saTest(1, 1) = "a"
saTest(2, 1) = "b"
saTest(3, 1) = "c"
rngTest = saTest
End Sub
The nice thing about this approach is that we can very quickly write data to
the spreadsheet, and without looping.
However, what if we want to go in the other direction? This statement fails:
saTest = rngTest
So, can anyone suggest a way to load an array with values from a
range--without looping?
Thanks.
Charley