By nesting one more loop, you can use a three-dimensional array to hold the data from the rows and columns in multiple worksheets : Multidimensional Arrays « Data Type « VBA / Excel / Access / Word






By nesting one more loop, you can use a three-dimensional array to hold the data from the rows and columns in multiple worksheets

 
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

 








Related examples in the same category

1.Multidimensional Arrays