Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Populate a multi-dimensional array from Ranges
I need to know if a multi-dimensional array can be populated directly from
non-contiguous ranges in a worksheet? I can do the following but it gets pretty slow when the number of rows exceeds 20000. For i = 1 to 10000 NewArray(i,0) = Worksheets("All_Data").Cells(5 + i, 6)).Value NewArray(i,1) = Worksheets("All_Data").Cells(5 + i, 12)).Value NewArray(i,2) = Worksheets("All_Data").Cells(5 + i, 22)).Value Next i I can also populate one-dimensional arrays directly from a range and then use a For Next Loop to populate NewArray(1 to 10000, 0 to 2) DateArray = Application.Transpose(ThisWorkbook.Sheets("All_Dat a").Range("F6:F10000")) DataArray1 = Application.Transpose(ThisWorkbook.Sheets("All_Dat a").Range("L6:L10000")) DataArray2 = Application.Transpose(ThisWorkbook.Sheets("All_Dat a").Range("V6:V10000")) For i = 1 to 10000 NewArray(i,0) = DateArray(i) NewArray(i,1) = DataArray1(i) NewArray(i,2) = DataArray2(i) Next i But Id like to be able to use something on the order of: Application.Index(NewArray, 0, 1) = Application.Transpose(ThisWorkbook.Sheets("All_Dat a").Range("L6:L1000")) Or Application.Index(NewArray, 0, 1) = DataArray1 Is this possible? If it is, can you give me an example? Thanks in advance, Raul |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multi Dimensional Array | Excel Programming | |||
Populate list box with multi-dimensional array | Excel Programming | |||
Multi Dimensional Array | Excel Programming | |||
Multi-Dimensional Array Let & Get | Excel Programming | |||
Viewing Multi dimensional array | Excel Programming |