Re: User Defined formula, selecting range



By passing the range to the function as a UDF, you can be flexible. For
instance, say your UDF is

Function myUDF(rng as Range)
Dim cell As Range
For Each cell in rng
myUDF=myUDF + cell.Value
Next cell
End Function

You can call it with one cell

=myUDF(A1)

many cells

=myUDF(A1:A10)

a multiple row/column range

=myUDF(A1:H10)

What you cannot do is use the format that you can with some built-in
functions, such as

=myUDF(A1,B10,C9)

although it could be changed to cater for that as well.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

<p.strijbosch@xxxxxxxxx> wrote in message
news:1136450888.344569.95140@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hello,
>
> Can someone tell me how to make a user defined formula in Excel that
> ables one to select a (flexibel) range.
> The formula has to be something similar to the standard VBA statement:
>
> Activecell.Select
> Selection.End(xlDown).Select
>
> Thanx a lot for your help!!!!
>
> regards,
> Robert
>


.