title: How do I declare an array variable in VBA?
body: <p>I need to add the var in array</p>
  
  <pre><code>Public Sub Testprog()
  
  Dim test As Variant
  Dim iCounter As Integer
  
  If test = Empty Then
      iCounter = 0
      test(iCounter) = "test"
  Else
      iCounter = UBound(test)
  End If
  End Sub
  </code></pre>
  
  <p>Getting error at <code>test(iCounter) = "test"</code></p>
  
  <p>Please suggest some solution</p>