title: loop through a multidimensional array in vba excel
body: <p>I'm trying to loop through a 2d array. The 1d will always be 25, the 2d will have different amounts. Quite often the members of the 1st dimensional will be empty which is the point of the isarray(sent) code. I'm getting a subscript out of range at the part which says for j = 1 to ubound(sent,2)</p>
  
  <pre><code>For i = 1 To 25
      If IsArray(sent(i)) Then
          For j = 1 To UBound(sent, 2)
              If concat_multi = "" Then
              concat_multi = sent(i, j)
              Else
              concat_multi = concat_multi &amp; " &amp; " &amp; sent(i, j)
              End If
          Next
          ActiveCell.Offset(1) = concat_multi
          concat_multi = ""
      End If
  Next
  </code></pre>
  
  <p>Here is a screenshot</p>
  
  <p><img src="https://i.stack.imgur.com/jxr9L.png" alt="enter image description here"></p>