Excel 2007
Is it possible to pass an array to a function parameter from the worksheet? I tried using braces but it's not working.
"=AddMyArray( {1,3,4,5,6} )" gives me an error
-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]
Is it possible to pass an array to a function parameter from the worksheet? I tried using braces but it's not working.
"=AddMyArray( {1,3,4,5,6} )" gives me an error
Code:
Option Explicit
Function AddMyArray(Numbers() As Single) As Single
Dim J As Integer
Dim K As Integer
Dim L As Integer
On Error Resume Next
J = UBound(Numbers)
L = LBound(Numbers)
On Error GoTo 0
For K = L To J
AddMyArray = AddMyArray + Numbers(K)
Next K
End Function
-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]