View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Range object in Worksheetfunction.Sum

hmm..
Dim MyRange as Range line has disappeared :(

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


keepITcool wrote in
ft.com


Cells used without a qualifier refer to the activesheet

Function CriteriaScore2() As Long


Dim MyRange as Range

With Worksheets("DecisionScores")
Set MyRange = .Range(.Cells(3, 2), .Cells(3, 6))
End With
CriteriaScore2 = WorksheetFunction.Sum(MyRange)
End Function

I change the function's type to Long.
(or Double).. to avoid problems where the sum 32k.