Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to assign ranges on different sheets to an array
I need to load 4 columns of data from two different worksheets into a list box
on a userform. I can load all the data (the data columns will all be the same, and they will always have 4000 to 10000 rows) into an array and assign the array to be the rowsource for the listbox. Currently, I am doing this by reading each cell value in a loop through each column. Is there a more efficient way to simply assign the ranges to the array without looping through all the data? Thanks Ken |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to assign ranges on different sheets to an array
Use an intermediate array. Pick up the column of values (or two adjacent
columns of values if adjacent) all at once, then loop through that making the assignments to the array. Dim var as Variant varr = Range("A1:B2000").Value now var is a (1 x 2000, 1 x 2) array. Regards, Tom Ogilvy KRCowen wrote in message ... I need to load 4 columns of data from two different worksheets into a list box on a userform. I can load all the data (the data columns will all be the same, and they will always have 4000 to 10000 rows) into an array and assign the array to be the rowsource for the listbox. Currently, I am doing this by reading each cell value in a loop through each column. Is there a more efficient way to simply assign the ranges to the array without looping through all the data? Thanks Ken |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to assign ranges on different sheets to an array
You should be able to achieve the same result by simply
assigning the "Value" property to the list, as in the following example: MyForm.MyListBox.List = Range("A1:A5000").Value -----Original Message----- I need to load 4 columns of data from two different worksheets into a list box on a userform. I can load all the data (the data columns will all be the same, and they will always have 4000 to 10000 rows) into an array and assign the array to be the rowsource for the listbox. Currently, I am doing this by reading each cell value in a loop through each column. Is there a more efficient way to simply assign the ranges to the array without looping through all the data? Thanks Ken . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Array formula: how to join 2 ranges together to form one array? | Excel Worksheet Functions | |||
Assign Values to array | Excel Discussion (Misc queries) | |||
combining cells and array from different sheets into an array to pass to IRR() | Excel Discussion (Misc queries) | |||
In a 2 Y-Axis chart, how do I assign data ranges to an axis? | Charts and Charting in Excel | |||
Is there a way to assign a specific printer to different sheets i. | Excel Worksheet Functions |