I am trying to return the sum of a range using a function "CriteriaScore".
Iam tryin to use the Cells object to specify the Range, but
VB is not happy.
If I define the function as follows, it works fine:
Function CriteriaScore () As Integer
Set MyRange = Worksheets("DecisionScores").Range("B3:F3")
CiteriaScore = WorksheetFunction.Sum(MyRange)
End Function
However, as soon as I introduce the Cells reference, it doens't work:
Function CriteriaScore () As Integer
Set MyRange = Worksheets("DecisionScores").Range(Cells(3, 2), Cells(3,
6))
CiteriaScore = WorksheetFunction.Sum(MyRange)
End Function
Any ideas?