Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array formula: how to join 2 ranges together to form one array? Rich_84 Excel Worksheet Functions 2 April 1st 09 06:38 PM
Assign Values to array Jeff Excel Discussion (Misc queries) 14 July 15th 08 06:06 PM
combining cells and array from different sheets into an array to pass to IRR() [email protected] Excel Discussion (Misc queries) 3 September 11th 06 07:17 AM
In a 2 Y-Axis chart, how do I assign data ranges to an axis? Claire4Golf Charts and Charting in Excel 1 September 28th 05 07:52 PM
Is there a way to assign a specific printer to different sheets i. Stage Lamp Excel Worksheet Functions 0 April 6th 05 02:39 AM


All times are GMT +1. The time now is 05:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"