I'm still new at VBA and this is a simple problem, but I'm comparing negative numbers who is greater or equal is "pass", else it "fail" for example if I inputed:
40
is pass,
20
is pass,
but if i input -20
it shows "fail" which is it should "pass" while I put -40
it "pass" which is it should "fail".
I don't know how to solve it because for me the condition is correct but the result isn't.
If Me.kepi4.Value >= "-30.70" Then
MsgBox "The KEPI 4 Value Pass the Evaluation"
Me.gd4.Value = "PASS"
UserForm9.Show
Else
MsgBox "Check Your Kepi 4 Evaluation Value"
Me.gd4.Value = "FAIL"
UserForm10.Show
End If
This "-30.70"
is a string/text and not a number. It should be -30.70
instead.
Also you should turn your textbox value into a double cDbl(Me.kepi4.Value)
so it is truned into a number that you can actually compare with mathematical operators >=
.
It should look like this:
If cDbl(Me.kepi4.Value) >= -30.70 Then