VBA/Excel/Access/Word/Data Type/Multidimensional Arrays
By nesting one more loop, you can use a three-dimensional array to hold the data from the rows and columns in multiple worksheets
<source lang="vb">
Sub nestLoop()
Dim I As Integer Dim J As Integer Dim K As Integer Dim myArray(99, 99, 2) As Integer For K = 0 To 2 "Worksheet index For J = 0 To 99 "Column index For I = 0 To 99 "Row index myArray(I, J, K) = Worksheets(K + 1).Cells(I + 1, J + 1).Value Next I Next J Next K
End Sub
</source>
Multidimensional Arrays
<source lang="vb">
Sub ArrayDemo()
Dim myArray(9, 2) As Integer Dim I As Integer Dim J As Integer Dim myArray(99, 99) As Integer For J = 0 To 99 "Column index For I = 0 To 99 "Row index myArray(I, J) = Cells(I + 1, J + 1).Value Next I Next J
End Sub
</source>