Closed Thread
Results 1 to 2 of 2

Create One-Dimensional Array from Two-Dimensional Array

  1. #1
    Stratuser
    Guest

    Create One-Dimensional Array from Two-Dimensional Array

    I need to create a one-dimensional array from a two-dimensional array. My
    two-dimensional array has R * C (rows times columns) elements. I want my
    one-dimensional array to have all the data from the two-dimensional array,
    except for the last column, so it needs to have R * (C-1) elements.

    Any ideas about how to construct this one-dimensional array?

  2. #2
    Tom Ogilvy
    Guest

    Re: Create One-Dimensional Array from Two-Dimensional Array

    Dim varr1()
    num = (ubound(varr,1) - lbound(varr,1) + 1) * _
    (ubound(varr,2) - lbound(varr,2))

    redim varr1(1 to num)
    for i = lbound(varr,1) to ubound(varr,1)
    for j = lbound(varr,2) to ubound(varr,2) - 1
    k = k + 1
    varr1(k) = varr(i,j)
    next
    Next

    --
    Regards,
    Tom Ogilvy


    "Stratuser" <[email protected]> wrote in message
    news:[email protected]...
    > I need to create a one-dimensional array from a two-dimensional array. My
    > two-dimensional array has R * C (rows times columns) elements. I want my
    > one-dimensional array to have all the data from the two-dimensional array,
    > except for the last column, so it needs to have R * (C-1) elements.
    >
    > Any ideas about how to construct this one-dimensional array?




Closed 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