View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default what's the problem with this ?

Apparently the "=" is not necessary. I guess most of the examples I've seen
use it, so I assumed it was needed.


"JMB" wrote:

I added "=", quotes around "*" and "," (after rng2). Also you need to use
the Address property for rng1 and rng2

Function mySP(rng1 As Range, rng2 As Range, Optional dec As Long = 2)
mySP = Evaluate("=SumProduct(Round(" & rng1.Address(, , , True) & "*" &
rng2.Address(, , , True) & "," & dec & "))")
End Function

"dribler2" wrote:

so short am i not to know the solution..never know the programming language.

anyone know how to make this UDfunction work..

Function mySP(rng1 As Range, rng2 As Range, Optional dec As Long = 2)
mySP = Application.Caller.Parent.Evaluate("SumProduct(Rou nd(" & rng1 * rng2,
dec & "))")
End Function

'syntax =mySP(A1:A100,B1:B100,1) ----SUM OF ROUNDED PRODUCT MADE OF 2 FACTOR
ONLY

happy holidays...
driller.