title: Passing an unknown number of arguments into ParamArray in VBA
body: <p>I have a function that takes in a <code>ParamArray</code> that I'm trying to pass an unknown number of parameters into. I'm looping through rows and passing in numbers based on if the cells are empty or not, but it seems like I have to pass in each number as its own argument. I tried putting the numbers into an array and passing that, but it just ended up being an array of an array in the function and not working properly. Is there a way to do this?</p>
  <p>Ex:</p>
  <pre class="lang-vb prettyprint-override"><code>Dim myarray() as double
  
  Function test(ParamArray arg() as Variant) as Single
    'function does stuff with arg(s)
  End Function
  </code></pre>
  <pre class="lang-vb prettyprint-override"><code>For Each cell in [somerange]
    If cell &lt;&gt; &quot;&quot; then
      'save cell value into an myarray?
    End If
  Next
  
  'want to pass those saved values into function
  Call test(myarray)
  </code></pre>
  <p>Edit: I kind of found a workaround. I realized I can pass a range into the function so I'm just going to create a temporary range and pass that in.</p>