I'm having problems with my code concerning a mulitdimensiona l array. Basically, I'm trying to create an array (arrTotal) which contains all of the data from 2 arrays (arrOne & arrTwo). Basically, they each contain data from Tables, and I just want to combine them into a single array which contains all of the info. Here's what I have so far, but I know something isn't right:
Dim i As Integer
Dim j As Integer
'This gives me the total upper boundaries of both arrays
ReDim arrTotal((UBoun d(arrOne, 1)) + (UBound(arrTwo, 1)))
'intCount2ndDim ension contains the Total Number of 2nd Dimensions for
'both arrays
For j = 0 To intCount2ndDime nsion
'Here is where my problem is: I'm trying to fill in the data from both
'arrays into arrTotal, but I'm having problems with the multidimension
'Do I need to add both the 1st and 2nd dimensions separately or can I do it like below?:
For i = 0 To UBound(arrOne, 1)
arrTotal(i) = arrOne(i, j)
Next
'I don't think this nesting is right. I want to have arrTotal contain
'both arrOne and arrTwo:
For i = 0 To UBound(arrTwo, 1)
arrTotal(i) = arrTwo(i, j)
Next
Next
End Sub
Sorry if I wasn't clear enough. I'd appreciate any thoughts. Thanks!
Dim i As Integer
Dim j As Integer
'This gives me the total upper boundaries of both arrays
ReDim arrTotal((UBoun d(arrOne, 1)) + (UBound(arrTwo, 1)))
'intCount2ndDim ension contains the Total Number of 2nd Dimensions for
'both arrays
For j = 0 To intCount2ndDime nsion
'Here is where my problem is: I'm trying to fill in the data from both
'arrays into arrTotal, but I'm having problems with the multidimension
'Do I need to add both the 1st and 2nd dimensions separately or can I do it like below?:
For i = 0 To UBound(arrOne, 1)
arrTotal(i) = arrOne(i, j)
Next
'I don't think this nesting is right. I want to have arrTotal contain
'both arrOne and arrTwo:
For i = 0 To UBound(arrTwo, 1)
arrTotal(i) = arrTwo(i, j)
Next
Next
End Sub
Sorry if I wasn't clear enough. I'd appreciate any thoughts. Thanks!
Comment