title: Compile Error: Expected Array - VBA
body: <p>Could anyone please explain what is the reason for this error? The code looks totally fine to me.</p>
  
  <pre><code>Public n As Long, i As Long, prodCode As String
  Private Sub newArray()
  
      n = wsProducts.Range("A1", wsProducts.Range("A1").End(xlDown)).Rows.Count
  
      ReDim prodCode(n)
  
      For i = 1 To n
          prodCode(i) = wsProducts.Range("A1").Offset(i, 0)
      Next i
  
  End Sub
  </code></pre>