creating a function with a for loop

  • Thread starter Thread starter creating a function with a for loop
  • Start date Start date
C

creating a function with a for loop

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top