transferring matrix to range

J

JackRnl

A worksheet contains 10000 rows containing each 10 groups of (9 column
of values PLUS 1 empty column).
I want to define a range for each group and load them into an (integer
matrix. After performing some calculations and changing some values o
the a matrix I would like to write the array back into the range.

Something like:
*********
dim rngData as object
dim arrValues(10000,9) as integer

with worksheets("Sheet-1")
set rngdata = range(.cells(1,1),.cells(10000,9))
arrValues = rngData.getvalues() 'a call like that but I don
know the right one
for i=1 to 10000
for j = 1 to 9
arrValues(i,j) = arrvalues(i,j) *rnd() '/// just SOM
calculation
next j
next i
rngdata.values = arrvalues ' a call like that but I don t know th
right one
end with
*********

How can I read the values into the matrix and how can I store th
values onto the range EFFICIENTLY
 
K

keepITcool

You must use a VARIANT to a block of data from an excel range.
(you can write any TYPED array to a range)

There WERE limitations to the size of the array.
Excel XP SP? and Excel 2003 dont have that limit any more.

Dim vData as Variant
vData =Range("a1:f10000").Value



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


JackRnl wrote in
 
A

Alan Beban

keepITcool said:
You must use a VARIANT to a block of data from an excel range.
(you can write any TYPED array to a range)

There WERE limitations to the size of the array.
Excel XP SP? and Excel 2003 dont have that limit any more.

Dim vData as Variant
vData =Range("a1:f10000").Value
I haven't taken the trouble to absorb all the aspects of this thread,
but if the functions in the freely downloadable file at
http://home.pacbell.net/beban are available to your workbook, the
following will work:

Dim vData() As Integer
Assign Range("a1:f10000"), vData
Debug.Print Typename(vData) '<----Prints "Integer()"

Alan Beban
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top