+ Reply to Thread
Results 1 to 7 of 7

Populate a Single Dimensional Array with two Dim Array (matrix)

  1. #1
    Registered User
    Join Date
    03-05-2011
    Location
    Barcelona, Spain
    MS-Off Ver
    Excel 2003
    Posts
    27

    Populate a Single Dimensional Array with two Dim Array (matrix)

    Hola,

    I know how to populate a 2 Dim. Array from a worksheet table and how to transpose such an Array.

    I wonder if there is a way to populate a Single Dim. Array (vector) with the 2 Dim. array values ?

    For example:
    How can one populate a 100 size Array from a 10X10 Size Array - WITHOUT using Loops ?

    Thanks, Ben
    Last edited by Benjamin1; 09-04-2011 at 05:28 PM.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Populate a Single Dimensional Array with two Dim Array (matrix)

    You can't.

    The simplest way I know is:

    Please Login or Register  to view this content.
    But: why would you ?
    Last edited by snb; 09-03-2011 at 11:38 AM.



  3. #3
    Registered User
    Join Date
    03-05-2011
    Location
    Barcelona, Spain
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Populate a Single Dimensional Array with two Dim Array (matrix)

    Thank you.

    Let us wait for more replies...

    Ben

    ******************** EDITED *******************
    By the way:

    The range A1:J10 has 100 cells.

    1) How come that the UBound(sn) returns only 90 ?

    2) In C01, your code combines J1 with A2 WITHOUT the in-between comma.
    Last edited by Benjamin1; 09-03-2011 at 10:04 AM.

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Populate a Single Dimensional Array with two Dim Array (matrix)

    I amended the previous code.
    Ubound(sn)=10

  5. #5
    Registered User
    Join Date
    03-05-2011
    Location
    Barcelona, Spain
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Populate a Single Dimensional Array with two Dim Array (matrix)

    Thanks.

    Ben

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Populate a Single Dimensional Array with two Dim Array (matrix)

    Do you mean something like

    Please Login or Register  to view this content.
    About UBound, it takes two arguments, the name of the array and the index being UBounded.
    The second argument defaults to 1 if ommitted.
    Similarly LBound.
    Please Login or Register  to view this content.
    Last edited by mikerickson; 09-03-2011 at 12:46 PM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  7. #7
    Registered User
    Join Date
    03-05-2011
    Location
    Barcelona, Spain
    MS-Off Ver
    Excel 2003
    Posts
    27

    Re: Populate a Single Dimensional Array with two Dim Array (matrix)

    Thanks Mike.

    Can I assume that there is, absolutely, no way to populate a single Dimmed Array with the content of a Matrix Array, without For-Next Loops through the source Array, and mark the thread as Solved ?

    Ben
    Last edited by Benjamin1; 09-03-2011 at 02:14 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1