title: VBA 3 Dimensional Array
body: <p>I have to use nested For/Next loops to populate a multi-dimensional array that holds the data from ranges A1:E5 on the previous 3 sheets. I then want to display the array on the current sheet. This is for class and the book really doesn't cover using 3 dimensional arrays much.</p>
  
  <pre><code>Private Sub multiWorksheetArray_Click()
  
  Dim multiSheetArray(2, 4, 4) As Variant 'array with 3 sheets, 5 columns/rows
  Dim I As Integer 'counters
  Dim J As Integer
  Dim S As Integer
  
  
  For S = 1 To 3
      For I = 1 To 5
          For J = 1 To 5
             'populate the array
              multiArray(S - 1, J - 1, I - 1) = ActiveWorkbook.Worksheets("Sheet" + S).Cells(J, I).Value
          Next J
      Next I
  Next S
  
  Range("A15:O19").Value = multiArray
  
  End Sub
  </code></pre>