Try this one:
Function IsSick(ArrAdr As Range) As Integer
Dim i As Integer, k As Integer
Dim arr As Range
Set arr = Range(ArrAdr.Value)
k = 0
For i = 2 To arr.Count
If arr(i) >= 37 Then k = k + 1
Next i
IsSick = k
End Function
or better:
Function IsSick(ArrAdr As Range) As Integer
IsSick = Application.CountIf(Range(ArrAdr.Value), ">=37")
End Function
Also note that when you're using Dim i, k As Integer
, only k
has type Integer
, while i
is Variant
. So, you should use Dim i As Integer, k As Integer
instead.