I am using an if statement in my procedure that calls upon my Boolean function; however, when I run the program, it always outputs the message as if the function were true.
Public Function INR() As Boolean
If Avg < 1.5 & SD < 0.5 Then
INR = True
Else
INR = False
End If
End Function
Public Sub PatientINR()
Range("B2", Range("B1").End(xlDown)).Name = "Name"
Dim cell As Range, reply As String, i As Long, x As Variant, Avg As Long, SD As Long
reply = InputBox("Enter patient's name", "INR", "Madelyn Carberry")
i = 1
x = Range("Name").Cells(i)
Do Until x = reply
i = i + 1
x = Range("Name").Cells(i)
Loop
Avg = Range("Name").Cells(i, 17)
SD = Range("Name").Cells(i, 18)
Call INR
If INR = True Then
MsgBox reply & "'s INR record is satisfactory for the procedure"
End If
If INR = False Then
MsgBox reply & "'s INR record is not satisfactory for the procedure"
End If
End Sub
Aucun commentaire:
Enregistrer un commentaire