title: Looping through a 3-D Array
body: <p>I initially asked this question <a href="https://stackoverflow.com/q/71879608/18748484">How to loop through a specific row of a 2-dimensional Array?</a>
  and @FaneDuru was kind enough to supply a solution but now I am hoping I can take it one step further and use a 3 dimensional array in order to obtain the item numbers needed for the second iteration I will be required to do. Initially I thought I would asssume the second iteration was the same as the first and just multiply my results by 2 but I would prefer using a 3-d Array in my solution. Here is what I got. I do not know how to display the results of the other index/iteration?</p>
  <pre><code>Dim SWArray() As Variant
  ReDim SWArray(1 To 5, 1 To 10, 1 To 2)
  SWArray(1, 1) = &quot;Bay1&quot;
  SWArray(1, 2) = &quot;Bay2&quot;
  SWArray(1, 3) = &quot;Bay3&quot;
  SWArray(1, 4) = &quot;Bay4&quot;
  SWArray(1, 5) = &quot;Bay5&quot;
  SWArray(1, 6) = &quot;Bay6&quot;
  SWArray(1, 7) = &quot;Bay7&quot;
  SWArray(1, 8) = &quot;Bay8&quot;
  SWArray(1, 9) = &quot;Bay9&quot;
  SWArray(1, 10) = &quot;Bay10&quot;
  
  SWArray(2, 1) = Bay1
  SWArray(2, 2) = Bay2
  SWArray(2, 3) = Bay3
  SWArray(2, 4) = Bay4
  SWArray(2, 5) = Bay5
  SWArray(2, 6) = Bay6
  SWArray(2, 7) = Bay7
  SWArray(2, 8) = Bay8
  SWArray(2, 9) = Bay9
  SWArray(2, 10) = Bay10
  
  'Loop through bays to assign purlin, girt and 
  'formboard item numbers per the dimension
  
  For k = LBound(SWArray, 3) To UBound(SWArray, 3)
  
  For i = LBound(SWArray, 2) To UBound(SWArray, 2)
      If SWArray(2, i) = 0 Then
      SWArray(2, i) = 0
      SWArray(3, i) = 0
      SWArray(4, i) = 0
      ElseIf SWArray(2, i) &gt; 6 And SWArray(2, i) &lt;= 10 Then
      SWArray(2, i) = 2035
      SWArray(3, i) = 2754
      SWArray(4, i) = 2004
      ElseIf SWArray(2, i) &gt; 10 And SWArray(2, i) &lt;= 12 Then
      SWArray(2, i) = 2036
      SWArray(3, i) = 2755
      SWArray(4, i) = 2005
      ElseIf SWArray(2, i) &gt; 12 And SWArray(2, i) &lt;= 14 Then
      SWArray(2, i) = 2037
      SWArray(3, i) = 2756
      SWArray(4, i) = 2006
      ElseIf SWArray(2, i) &gt; 14 And SWArray(2, i) &lt;= 16 Then
      SWArray(2, i) = 2038
      SWArray(3, i) = 2757
      SWArray(4, i) = 2007
  
      End If
  
      Next i
  
      Next k
  
      Worksheets(&quot;Data&quot;).Range(&quot;A55&quot;).Resize(UBound(SWArray), 
      UBound(SWArray, 2)).Value = SWArray
  </code></pre>