title: Excel UDF that accepts both Range and Array as Parameter like 'SUM'
body: <p>I an writing a UDF that needs to accept both Arrays and Ranges.</p>
  
  <p>Usually declaring parameter as variant would work but a Range is an object so this no longer applies. That being said bellow I pasted code that only works when passing an array.<br>
  Here is theorethical example, based on <code>SUM</code>:</p>
  
  <pre><code>Function TSUM(numbers() As Variant) As Variant
      Dim i As Integer
      For i = 1 To UBound(numbers, 1)
          TSUM = TSUM + numbers(i)
      Next i
  End Function
  </code></pre>
  
  <blockquote>
    <p>=TSUM({1,1})   Returns 2<br>
    =TSUM(A1:B1)   Returns #VALUE!</p>
  </blockquote>
  
  <p>So how can I fix above example to accept Ranges as well?</p>