Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I know the following code will work fine for me: Function ArrayFromRange(Rng As Range) As Variant ArrayFromRange = Rng End Function But I just want to know why the following alternative doesn't work, especially why the REDIM statement is invalid he Function ArrayFromRange(Rng As Range) As Variant Dim i As Long, j As Long ReDim ArrayFromRange(Rng.Rows.count, Rng.Columns.count) For i = 1 To Rng.Rows.count For j = 1 To Rng.Columns.count ArrayFromRange(i, j) = Rng(i, j) Next Next End Function By the way, if I wish a function to return an array, is declaring the function as type "variant' the only way? Thanks for your advice. Frederick Chow Hong Kong. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to Read Worksheet Data into VBA Array? | Excel Discussion (Misc queries) | |||
Excel, read in an array | Setting up and Configuration of Excel | |||
Read comboboxes into array | Excel Programming | |||
Read in Array | Excel Programming | |||
Read Range Data into Array | Excel Programming |