J
Jan Kronsell
Hi NG
I have made a function, that works perfectly allright, doing some
calculation based on the contents of two ranges, but I would like to pass
the two ranges as arguments in stead of "hard-coding" them into the
function. However i can'øt get it to work. This is the working code.
Function JaNej() As String
n = 0
m = 0
Application.Volatile
For Each c In Range("d28:i28").Cells
If c.Value = "nej" Then
n = n + 1
Else
n = n + 0
End If
Next c
For Each c In Range("d30:i30").Cells
If c.Value = "nej" Then
m = m + 1
Else
m = m + 0
End If
Next c
If n > 0 Then
JaNej = "Nej"
Else
JaNej = "Ja"
End If
End Function
Jan
I have made a function, that works perfectly allright, doing some
calculation based on the contents of two ranges, but I would like to pass
the two ranges as arguments in stead of "hard-coding" them into the
function. However i can'øt get it to work. This is the working code.
Function JaNej() As String
n = 0
m = 0
Application.Volatile
For Each c In Range("d28:i28").Cells
If c.Value = "nej" Then
n = n + 1
Else
n = n + 0
End If
Next c
For Each c In Range("d30:i30").Cells
If c.Value = "nej" Then
m = m + 1
Else
m = m + 0
End If
Next c
If n > 0 Then
JaNej = "Nej"
Else
JaNej = "Ja"
End If
End Function
Jan