Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copying a dimension of an array

Status
Not open for further replies.

dpimental

Programmer
Jul 23, 2002
535
US
If I had a two dimensional array ...
Code:
Dim arrTest(1 to 3, 1 to 3) as string

And I wanted to copy 1 of the dimensions to another array of equal length, but only one dimension, could I do that. Well, obviously I can't. But is there a way to copy a single dimension of a multi-dimensional array, to another array?

David Pimental
(US, Oh)
 
You wanted something like this ?
Dim arrTest(1 To 3, 1 To 5) As String
Dim arrSingle1(1 To 5) As String
Dim arrSingle2(1 To 5) As String
Dim arrSingle3(1 To 5) As String
Dim i As Integer
For i = 1 To 5
arrSingle1(i) = arrTest(1, i)
arrSingle2(i) = arrTest(2, i)
arrSingle3(i) = arrTest(3, i)
Next

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, that's a good idea. Much thanks.

David Pimental
(US, Oh)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top