Thread
:
How To Fill 2D Arrays Easily
View Single Post
#
7
Posted to microsoft.public.excel.programming
keepITcool
external usenet poster
Posts: 2,253
How To Fill 2D Arrays Easily
you'd need a 25 'row' array to copy
5 times a 5 row range.
filling it as 1 large array you can only do it
in a loop
untested..
dim rng,iSet&,iRow&,iCol&
redim arr(1 to 25,1 to 256)
for each rng in array(Range("B9:L9"),Range("B14:L14"),etc)
With rng
For irow=1 to 5
For icol=1 to .columns.count
arr((iset)*5 +irow,icol) = .cells(irow,icol)
Next
Next
end with
iset=iset+1
next
--
keepITcool
|
www.XLsupport.com
| keepITcool chello nl | amsterdam
wrote :
I'm sorry I've told you the wrong thing! (Early morning blues)
I've hust tried to see how your posts would help me.......and noticed
I've posted totally the wrong scenario.
My apologies.
Dim testarray()
ReDim testarray(1 To 5, 1 To 256)
testarray() = Range("B9:L9").Value
testarray() = Range("B14:L14").Value
End Sub
This is what my first post should have been where the 2nd line
ovrwrites the array data.
I want to copy 5 ranges into my Array. The length of each range is
identical but not known before hand hence 1 to 256.
Sorry to bother you again. I can do it by copying the ranges to a
temp sheet where they are all coincident and then put them into the
array but want to avoid this if possible.
Cheers Chaps.
Donna
Reply With Quote
keepITcool
View Public Profile
Find all posts by keepITcool