Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Big Array from several worksheets

Hello!
I have a very large array which has to be filled with the information from
several worksheets.
Thus far, the strategy I use is to Create an independent Array for the info
on each Worksheet, and then I Consolidate the arrays into one (see procedure
below). However, this is a time consuming procedure which takes up to one
minute.
Maybe someone has some advice to do this faster?
I was thinking something in the lines of...

Sub ArrayConsolidator()
Dim ArrayUnion(1 To 40, 1 To 2) As Variant
ArrayUnion(1 to 20,1 to 2)=Range("A1","B20")
ArrayUnion(21 to 40,1 to 2)=Range("A21","B40")
End Sub

This of course, does not work, but the idea is to fill the big array
partially, and thus not having to consolidate it later. Filling the array by
"Brute Force" is not an option, since the sheets have 65,000 X 12 entries
each, and it takes for ever!
Following is the procedure I currently use to consolidate the arrays.
Best regards,
Albert C.

Sub CallArrayConsolidator
call CallArrayConsolidator(Array1, Array2, Array3)
End sub
Sub ArrayConsolidator(ParamArray vArr())

Dim i As Long, j As Long, k As Long
Dim vE As Variant

i = 0
For Each vE In vArr
i = i + UBound(vE, 1)
Next vE

ReDim MatrizMovimientos(1 To i, 1 To TotalFields)

i = 0
For Each vE In vArr
For j = 1 To UBound(vE, 1)
i = i + 1
For k = 1 To TotalFields
MatrizMovimientos(i, k) = vE(j, k)
Next k
Next j
Next vE

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Big Array from several worksheets

Why not just use

Dim ArrayUnion

ArrayUnion = Application.Transpose(Range("A1:B40"))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Albert" wrote in message
...
Hello!
I have a very large array which has to be filled with the information from
several worksheets.
Thus far, the strategy I use is to Create an independent Array for the
info
on each Worksheet, and then I Consolidate the arrays into one (see
procedure
below). However, this is a time consuming procedure which takes up to one
minute.
Maybe someone has some advice to do this faster?
I was thinking something in the lines of...

Sub ArrayConsolidator()
Dim ArrayUnion(1 To 40, 1 To 2) As Variant
ArrayUnion(1 to 20,1 to 2)=Range("A1","B20")
ArrayUnion(21 to 40,1 to 2)=Range("A21","B40")
End Sub

This of course, does not work, but the idea is to fill the big array
partially, and thus not having to consolidate it later. Filling the array
by
"Brute Force" is not an option, since the sheets have 65,000 X 12 entries
each, and it takes for ever!
Following is the procedure I currently use to consolidate the arrays.
Best regards,
Albert C.

Sub CallArrayConsolidator
call CallArrayConsolidator(Array1, Array2, Array3)
End sub
Sub ArrayConsolidator(ParamArray vArr())

Dim i As Long, j As Long, k As Long
Dim vE As Variant

i = 0
For Each vE In vArr
i = i + UBound(vE, 1)
Next vE

ReDim MatrizMovimientos(1 To i, 1 To TotalFields)

i = 0
For Each vE In vArr
For j = 1 To UBound(vE, 1)
i = i + 1
For k = 1 To TotalFields
MatrizMovimientos(i, k) = vE(j, k)
Next k
Next j
Next vE

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Big Array from several worksheets

Hey Bob.
I would, but in reality, the ranges are in different sheets.

"Bob Phillips" wrote:

Why not just use

Dim ArrayUnion

ArrayUnion = Application.Transpose(Range("A1:B40"))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Albert" wrote in message
...
Hello!
I have a very large array which has to be filled with the information from
several worksheets.
Thus far, the strategy I use is to Create an independent Array for the
info
on each Worksheet, and then I Consolidate the arrays into one (see
procedure
below). However, this is a time consuming procedure which takes up to one
minute.
Maybe someone has some advice to do this faster?
I was thinking something in the lines of...

Sub ArrayConsolidator()
Dim ArrayUnion(1 To 40, 1 To 2) As Variant
ArrayUnion(1 to 20,1 to 2)=Range("A1","B20")
ArrayUnion(21 to 40,1 to 2)=Range("A21","B40")
End Sub

This of course, does not work, but the idea is to fill the big array
partially, and thus not having to consolidate it later. Filling the array
by
"Brute Force" is not an option, since the sheets have 65,000 X 12 entries
each, and it takes for ever!
Following is the procedure I currently use to consolidate the arrays.
Best regards,
Albert C.

Sub CallArrayConsolidator
call CallArrayConsolidator(Array1, Array2, Array3)
End sub
Sub ArrayConsolidator(ParamArray vArr())

Dim i As Long, j As Long, k As Long
Dim vE As Variant

i = 0
For Each vE In vArr
i = i + UBound(vE, 1)
Next vE

ReDim MatrizMovimientos(1 To i, 1 To TotalFields)

i = 0
For Each vE In vArr
For j = 1 To UBound(vE, 1)
i = i + 1
For k = 1 To TotalFields
MatrizMovimientos(i, k) = vE(j, k)
Next k
Next j
Next vE

End Sub




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 across multiple worksheets rda Excel Discussion (Misc queries) 1 April 23rd 08 07:31 PM
Two worksheets, one array bob Excel Discussion (Misc queries) 2 June 14th 06 11:26 PM
Array to Worksheets Paul W Smith[_4_] Excel Programming 2 March 16th 06 08:29 PM
For....Next- Array of worksheets. Julian Milano[_2_] Excel Programming 5 December 15th 03 01:09 PM
array worksheets GUS Excel Programming 1 September 23rd 03 03:13 AM


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

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

About Us

"It's about Microsoft Excel"