I am having trouble with the boundaries of an array. I have 3 worksheets. The first 2 have i convert into two arrays (array1 & array2), and then do calculations between them to create the third. The issue is I am not sure what the boundaries are of the third array, since it will always change depending on the inputs.
I have been just using Dim array3 (5000, 5) with a dummy of 5000 rows (1st dimension) since I don't think there will be more than that. Is there a way to create the array with out boundaries and then add info to it, then dim the dimensions?
Also the Macro I created utilizes this piece of code ---
Z = 1
For x = 1 To UBound(array1, 1)
For y = 1 To UBound(array2, 1)
If array1(x, 4) = 0 Then
GoTo Line1
End If
If array1(x, 1) = array2(y, 1) And array1(x, 2) = array2(y, 3)Then
If array1(x, 4) > array2(y, 5) Then
array3(z, 1) = array1(x, 3)
ElseIf array1(x, 4) = array2(y, 5) Or array1(x, 4) < array2(y, 5) Then
array3(z, 1) = array1(x, 3)
End If
z = z + 1
End If
Next y
Line1:
Next x
It takes a piece of array1 and loops it through array2 and creates a result in array3
Basically when array1(x, 4) = 0, I need it to move on to the next X. I can't figure out how to loop this without the GoTO Line1. If i move it down, then it will continue to loop through arry2 (y), instead of moving on to next X. If i move it above, then y resets and it runs through the For y loop again