pepe90
07-25-2011, 06:02 AM
Hello, does somebody know how can I change the number of rows of a matrix? Here is what I thought that could work:
With Sheets("DATOS")
j = 2
Do While .Cells(j, 2) <> ""
If .Cells(j, 2) = maquinas(i) Then
maqs_encontradas = maqs_encontradas + 1
ReDim Preserve MATRIZ(1 To maqs_encontradas, 1 To 4)
For k = 1 To 4
MATRIZ(maqs_encontradas, k) = .Cells(j, k + 1)
Next
End If
j = j + 1
Loop
End With
once maqs_encontradas is 2, it throws me a subindex error on the ReDim line. I've done the same thing changing the size of a 1-dimensional array and worked just fine. Thanks in advance
With Sheets("DATOS")
j = 2
Do While .Cells(j, 2) <> ""
If .Cells(j, 2) = maquinas(i) Then
maqs_encontradas = maqs_encontradas + 1
ReDim Preserve MATRIZ(1 To maqs_encontradas, 1 To 4)
For k = 1 To 4
MATRIZ(maqs_encontradas, k) = .Cells(j, k + 1)
Next
End If
j = j + 1
Loop
End With
once maqs_encontradas is 2, it throws me a subindex error on the ReDim line. I've done the same thing changing the size of a 1-dimensional array and worked just fine. Thanks in advance