Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Getting data into an array

I have three discontiguous ranges, each with the same number of columns, but
each may have a different number of rows.

I want to copy the data from each of the ranges into a single array
preserving their relative row/column positions from the source.

When the array is written out, it should write the data into cells in the
same relative position, but as a single contiguous range.

So, for example, if the source has three sets of selections, each 5 columns
wide, one has two rows, one has three rows, and one has four rows, then the
data should write out as a single contiguous range having 9 rows and 5
columns.

Mostly, I need help with getting the data into the array, I think I can take
care of the write out.

Thanks much for your help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Getting data into an array

Are these the same five columns, but different row ranges within them? If
not, then what determines the order of placement... rows or columns? I ask
this question because you could have ranges that include, as an example,
these two ranges (assume the third range is lower down and to the right of
them)... B6:F9 and H2:L4... which of these is considered *first* in order
(to determine the "relative position")?

--
Rick (MVP - Excel)


"xp" wrote in message
...
I have three discontiguous ranges, each with the same number of columns,
but
each may have a different number of rows.

I want to copy the data from each of the ranges into a single array
preserving their relative row/column positions from the source.

When the array is written out, it should write the data into cells in the
same relative position, but as a single contiguous range.

So, for example, if the source has three sets of selections, each 5
columns
wide, one has two rows, one has three rows, and one has four rows, then
the
data should write out as a single contiguous range having 9 rows and 5
columns.

Mostly, I need help with getting the data into the array, I think I can
take
care of the write out.

Thanks much for your help!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Getting data into an array

Do you really want the data in an array or just write it to the worksheet in
order. How are you specifying the different selections. Usually when I seee
something like this it is usually making a summary sheet where the data
starts in the same location on 2 or more different sheets and the data is
combined on a new summary sheet.

"xp" wrote:

I have three discontiguous ranges, each with the same number of columns, but
each may have a different number of rows.

I want to copy the data from each of the ranges into a single array
preserving their relative row/column positions from the source.

When the array is written out, it should write the data into cells in the
same relative position, but as a single contiguous range.

So, for example, if the source has three sets of selections, each 5 columns
wide, one has two rows, one has three rows, and one has four rows, then the
data should write out as a single contiguous range having 9 rows and 5
columns.

Mostly, I need help with getting the data into the array, I think I can take
care of the write out.

Thanks much for your help!

  #4   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Getting data into an array

I don't have the full solution but the following code can be used to obtain
the correctly sized array...

Sub Create_Array()

'highlight the three ranges

Dim r As Range
Dim row As Integer, col As Integer
Dim arr() As Integer

For Each r In Selection.Areas
If col < r.Columns.Count Then
col = r.Columns.Count
End If
row = row + r.Rows.Count
Next r

ReDim arr(row, col) As Integer


End Sub



"xp" wrote:

I have three discontiguous ranges, each with the same number of columns, but
each may have a different number of rows.

I want to copy the data from each of the ranges into a single array
preserving their relative row/column positions from the source.

When the array is written out, it should write the data into cells in the
same relative position, but as a single contiguous range.

So, for example, if the source has three sets of selections, each 5 columns
wide, one has two rows, one has three rows, and one has four rows, then the
data should write out as a single contiguous range having 9 rows and 5
columns.

Mostly, I need help with getting the data into the array, I think I can take
care of the write out.

Thanks much for your help!

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
Display an Array of Data Based on Other Data golddave via OfficeKB.com Excel Worksheet Functions 4 September 17th 09 08:46 PM
Redimming an array dynamically assigned from range (how to redim first dimension of a 2-D array? /or/ reverse the original array order) Keith R[_2_] Excel Programming 3 November 13th 07 04:08 PM
meaning of : IF(Switch; Average(array A, array B); array A) DXAT Excel Worksheet Functions 1 October 24th 06 06:11 PM
What is the maximum allowed number of data elements in a data array? [email protected] Excel Discussion (Misc queries) 2 April 7th 05 06:56 PM
Q: Best way to take data from VBA into graphs without writing data to worksheets? (Can a named range refer to an array in memory only?) KR Excel Programming 2 December 16th 04 11:12 PM


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

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

About Us

"It's about Microsoft Excel"