Hi, I am trying to sum columns with varying amounts of rows. I thouht this would be a simple code to write, but I am getting #VALUE as the result. I'm new to VB so any help is appreciated!! Here is my code:
Public Function sumfunction(inum, itemarray()) As Double
For i = 1 To inum
sumfunction = sumfunction + itemarray(i)
Next
End Function
I tested this code by placing digits 1 through 6 in cells A1 through A6, then used the formula, sumfunction(6,A1:A6) in cell A7. I received a #VALUE. Any thoughts?
Thank you!!!
Bookmarks