Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I would like to use a range of cells in a UDF to input variables. A trivial example, without using ranges, would be: ______________________________________ Function SimpleSum(s0,s1,s2,s3) SimpleSum = (s0 + s2 + s3 + s4) End Function ______________________________________ The input would be, "SimpleSum(A1,A2,A3,A4)", No problem! However, what if I wanted to use a range. Here is an example just to illiterate the problem. Why does the following function not work. _______________________________________ Function SimpleAve(iSpike As Range) Dim n As Integer n = iSpike.Count ReDim s(n) i = 0 For Each cell In iSpike s(i) = cell.Value i = i + 1 Next cell SimpleAve = (s0 + s1 + s2 + s3)/n End Function _________________________________________ I would like the input to be a range, i.e. SimpleAve(A1:A4) Thanks in advance! Peter |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I have have one column's input depend on the variables in a second one? | Excel Worksheet Functions | |||
Using variables in Chart Ranges | Charts and Charting in Excel | |||
Cell Variables and Ranges | Excel Discussion (Misc queries) | |||
How do I add input data in the input ranges in drop down boxes. | Excel Discussion (Misc queries) | |||
using variables to set ranges | Excel Programming |