Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Reading from a excel sheet to an array

i am running simulation analysis. Each simulation returns results comes in
cells b60 to b85 of sheet2. next simulation will also return its output in
the same range.

suppose i am running 10 simulations. each simulation output is basically a
10 rows by 1 column range in sheet2. this results need to go into an array
called FinalOutput which would be a 26 by 10 array. I want to read the entire
range "b60 to b85" in sheet2 into the FinalOutput array. Basically depending
on the simulation number, an entire column of FinalOutput array gets created.
so simulation 1 output gets transferred to column 1 of final output array and
so on. is there some way i can transfer an entire range into a column of an
array.

thanks
pradip

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Reading from a excel sheet to an array

something like this:

Set rng = Range("A1:A3")

For i = 1 To 3
a(i, 1) = rng(i, 1)
Next i

Range("A13").Resize(3, 2) = a


Mangesh


"Pradip Jain" wrote in message
...
i am running simulation analysis. Each simulation returns results comes in
cells b60 to b85 of sheet2. next simulation will also return its output in
the same range.

suppose i am running 10 simulations. each simulation output is basically a
10 rows by 1 column range in sheet2. this results need to go into an array
called FinalOutput which would be a 26 by 10 array. I want to read the

entire
range "b60 to b85" in sheet2 into the FinalOutput array. Basically

depending
on the simulation number, an entire column of FinalOutput array gets

created.
so simulation 1 output gets transferred to column 1 of final output array

and
so on. is there some way i can transfer an entire range into a column of

an
array.

thanks
pradip



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Reading from a excel sheet to an array

Not unless you want to have an array of arrays. however, for so small a
range, you shouldn't have much impact.

--
Regards,
Tom Ogilvy



"Pradip Jain" wrote in message
...
i am running simulation analysis. Each simulation returns results comes in
cells b60 to b85 of sheet2. next simulation will also return its output in
the same range.

suppose i am running 10 simulations. each simulation output is basically a
10 rows by 1 column range in sheet2. this results need to go into an array
called FinalOutput which would be a 26 by 10 array. I want to read the

entire
range "b60 to b85" in sheet2 into the FinalOutput array. Basically

depending
on the simulation number, an entire column of FinalOutput array gets

created.
so simulation 1 output gets transferred to column 1 of final output array

and
so on. is there some way i can transfer an entire range into a column of

an
array.

thanks
pradip



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Reading from a excel sheet to an array

Pradip Jain wrote:
i am running simulation analysis. Each simulation returns results comes in
cells b60 to b85 of sheet2. next simulation will also return its output in
the same range.

suppose i am running 10 simulations. each simulation output is basically a
10 rows by 1 column range in sheet2. this results need to go into an array
called FinalOutput which would be a 26 by 10 array. I want to read the entire
range "b60 to b85" in sheet2 into the FinalOutput array. Basically depending
on the simulation number, an entire column of FinalOutput array gets created.
so simulation 1 output gets transferred to column 1 of final output array and
so on. is there some way i can transfer an entire range into a column of an
array.

thanks
pradip

??? Where is the FinalOutput array between simulations?

Alan Beban
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Reading from a excel sheet to an array

It isn't at all clear what your process is, but on the narrow question
of transferring the contents of a column to a column of an array, if the
functions in the freely downloadable file at
http:/home.pacbell.net/beban are available to your workbook, the
following will transfer the contents of the range to the 4th "column" of
the array FinalOutput if it is an array of 26 rows and at least n columns:

n=4 'Simulation number
Set rng = Sheets("sheet2").Range("b60.b85")
ReplaceSubArray FinalOutput, rng, 1, n

This can, of course, also be done directly by

For i = 1 to 26
FinalOutput(i,n) = rng(i)
Next

Alan Beban

Pradip Jain wrote:
i am running simulation analysis. Each simulation returns results comes in
cells b60 to b85 of sheet2. next simulation will also return its output in
the same range.

suppose i am running 10 simulations. each simulation output is basically a
10 rows by 1 column range in sheet2. this results need to go into an array
called FinalOutput which would be a 26 by 10 array. I want to read the entire
range "b60 to b85" in sheet2 into the FinalOutput array. Basically depending
on the simulation number, an entire column of FinalOutput array gets created.
so simulation 1 output gets transferred to column 1 of final output array and
so on. is there some way i can transfer an entire range into a column of an
array.

thanks
pradip



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Reading from a excel sheet to an array

Alan Beban wrote:
It isn't at all clear what your process is, but on the narrow question
of transferring the contents of a column to a column of an array, if the
functions in the freely downloadable file at
http:/home.pacbell.net/beban are available to your workbook, the
following will transfer the contents of the range to the 4th "column" of
the array FinalOutput if it is an array of 26 rows and at least n columns:

n=4 'Simulation number
Set rng = Sheets("sheet2").Range("b60.b85")
ReplaceSubArray FinalOutput, rng, 1, n

This can, of course, also be done directly by

For i = 1 to 26
FinalOutput(i,n) = rng(i)
Next

Alan Beban


Undoubtedly faster (but I didn't test that) would be

arrTemp = rng
For i = 1 to 26
FinalOutput(i,n) = arrTemp(i,1)
Next

Alan Beban


Pradip Jain wrote:

i am running simulation analysis. Each simulation returns results
comes in cells b60 to b85 of sheet2. next simulation will also return
its output in the same range.

suppose i am running 10 simulations. each simulation output is
basically a 10 rows by 1 column range in sheet2. this results need to
go into an array called FinalOutput which would be a 26 by 10 array. I
want to read the entire range "b60 to b85" in sheet2 into the
FinalOutput array. Basically depending on the simulation number, an
entire column of FinalOutput array gets created. so simulation 1
output gets transferred to column 1 of final output array and so on.
is there some way i can transfer an entire range into a column of an
array.

thanks pradip

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
Reading a Range to an Array Kevin H. Stecyk[_2_] Excel Programming 6 January 26th 05 11:01 PM
Reading data from an excel sheet and writing to another Rain Excel Programming 1 January 19th 05 09:25 AM
Reading a VBA Array - Thanks SMS - John Howard Excel Programming 0 October 30th 04 11:35 PM
Reading .csv file into array mousetrap Excel Programming 1 November 26th 03 07:47 AM
[excel 97 vba ] Reading ranges into an array steve Excel Programming 1 October 30th 03 02:10 PM


All times are GMT +1. The time now is 12:06 AM.

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"