You don't have to loop through like that. Just copy the array.
Dim MatrizMovimientos as Variant
MatrizMovimientos = MatrizDatos
Demonstration code:
Dim x(2, 3) As String
Dim xcopy As Variant
x(0, 0) = "0,0"
x(0, 1) = "0,1"
x(0, 2) = "0,2"
x(0, 3) = "0,3"
x(1, 0) = "1,0"
x(1, 1) = "1,1"
x(1, 2) = "1,2"
x(1, 3) = "1,3"
x(2, 0) = "2,0"
x(2, 1) = "2,1"
x(2, 2) = "2,2"
x(2, 3) = "2,3"
xcopy = x
For i = 0 To 2
Debug.Print xcopy(i, 0)
Next
Ray at work
ASP[.Net] MVP
"Albert" <(E-Mail Removed)> wrote in message
news:90EFF586-BABE-4C10-B6B4-(E-Mail Removed)...
> Hello!
> I have a very big array and I want to make a copy of it under a different
> name.
> Right now I am doing it by "muscle", but is there a faster, simpler way of
> doing it?
> This is the code I am using right now. I want to copy MatrizDatos into
> MatrizMovimientos.
>
> ReDim MatrizMovimientos(1 To UBound(MatrizDatos, 1), 1 To 12)
> For x = 1 To UBound(MatrizMovimientos, 1)
> For z = 1 To 12
> MatrizMovimientos(x, z) = MatrizDatos(x, z)
> Next z
> Next x
>
> Thanx,
> Albert C
|