# Create One-Dimensional Array from Two-Dimensional Array

1. ## 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. ## 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" <Stratuser@discussions.microsoft.com> wrote in message
news:3C5243A9-0658-4661-9BCA-E722C5C24683@microsoft.com...
> 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?

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

#### 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