An If ... Then .... on a single line is considered a complete If statement, that doesn't have an Else clause. Instead, move the part to its own line:
Code:
If Z_score < 1.8 Then
Message = "Very High"
ElseIf (Z_score > 1.81 And Z_score <= 2.7) Then
Message = "High"
ElseIf Z_score > 2.71 And Z_score <= 2.9 Then
Message = "Possible"
Else : Message = "Not Likely"
End If
But better yet, use a Select Case statement like this:
Code:
Select Case Z_score
Code:
Case Is < 1.8
Message = "Very High"
Case 1.81 To 2.7
Message = "High"
Case 2.71 To 2.9
Message = "Possible"
Case Is > 2.9
Message = "Not Likely"
End Select
I'm not sure if this is by design, but it looks like there's a subtle bug in your code:
You compare this:
Z_score <= 2.7
and this:
Z_score > 2.71
This means that everything between 2.7 and (including) 2.71 will never cause the message to be changed....
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
Pardon Me by
Incubus (Track 12 from the album:
Make Yourself)
What's This?