Not sure if this is what you are asking for
Cal with
=MyTotal(A1:C1,A3:C3)
Function MyTotal(ParamArray target() As Variant)
MyTotal = 0
For MyRange = 0 To UBound(target)
For Each cell In target(MyRange)
MyTotal = MyTotal + cell.Value
Next cell
Next MyRange
End Function
"creating a function with a for loop" wrote:
> Could you please tell me how to create a compound function with a for loop?
>
> The function is SCP!B4=sum{(from MCDcsillag!B4 to MCDcsillag!B13)*sum[(from
> XDF!B4 to XDF!B11)*(from RDF!B4 to RDF!B11)*(from XFP!B4 to XFP!I4)*(from
> RFP!B4 to RFP!I4)]}
>
> this should be defined in VB.
>
> Thanks in advance.
>
> Sophie
|