title: VBA - error "Constant expression require "
body: <p>I am doing the lab with 2 dimensions array in VBA, but got the issue as my photo attached. Could you please help assist if any error ? Any assist will be very appriciated.
  this is my code :</p>
  <pre><code>        Sub read_data()
       
          Dim rng As Range
          Set rng = Sheet1.Range(&quot;C8:G12&quot;)
         total_row = Sheet1.Range(&quot;C8:G12&quot;).Rows.Count
         total_col = Sheet1.Range(&quot;C8:G12&quot;).Columns.Count
          Dim arr2(total_row, total_col)
          
          arr2 = rng
          For i = 0 To total_row
              For j = 0 To total_col
                  Debug.Print i, j, arr2(i, j)
              Next j
          Next i
  
  End Sub
  </code></pre>
  <p>the error as below:</p>
  <p><a href="https://i.stack.imgur.com/fwmc4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fwmc4.jpg" alt="enter image description here" /></a></p>