ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Read Range Data into Array (https://www.excelbanter.com/excel-programming/296328-read-range-data-into-array.html)

stratuser

Read Range Data into Array
 
What is the most efficient way to read a range's data into
a two-dimensional array? I have been in the habit of
using loops, but wonder if there aren't better ways, like
just declaring a variant variable and assigning it to the
range's values, which seems to work (and it's simple).

Charles Williams

Read Range Data into Array
 
The most efficient way by far is to declare a variant variable and assign
the range to it.

its usually best to use varArr=oRange.value2 rather than varArr=oRange.value
or varArr=oRange because you usually want cells formatted as currency or
dates to be coerced to doubles rather than currency or dates.


regards
Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com/FxlV2WhatsNew.htm

"Stratuser" wrote in message
...
What is the most efficient way to read a range's data into
a two-dimensional array? I have been in the habit of
using loops, but wonder if there aren't better ways, like
just declaring a variant variable and assigning it to the
range's values, which seems to work (and it's simple).





All times are GMT +1. The time now is 11:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com