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


Cells used without a qualifier refer to the activesheet

Function CriteriaScore2() As Long
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.


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


Nuraq wrote in

Function CriteriaScore () As Integer
Set MyRange = Worksheets("DecisionScores").Range(Cells(3, 2),
Cells(3, 6)) CiteriaScore = WorksheetFunction.Sum(MyRange)
End Function