-
Application.InputBox Zero is False??
I have a short routine to generate a small report. I thought i had covered all the bases. But... well here's some code
[VBA]
msgliq = "Enter Current Liquifaction Rate in MM" & [vbCrLf] & "FT-162"
validentry = False
Do
liqrate = Application.InputBox(msgliq, "Rate", , , , , , 3)'Accepts numbers or text
'If liqrate = False Then Exit Do 'THIS IS THE LINE THAT FAILS
If liqrate = "" Then Exit Do
If IsNumeric(liqrate) Then
If liqrate >= 0 And liqrate <= 20 Then validentry = True
Else: msgliq = "Enter Current Liquifaction Rate in MM, eg 12.5"
End If
Loop Until validentry
'If liqrate = False Then finish 'To a sub to "clean up" and exit
If liqrate = "" Then liqrate = "0.00"
[g16] = liqrate
[/VBA]
If one enters 0(zero) into this InputBox, this is seen as False and hence exits. I included this line in the event one used the Cancel option, in which case I want to exit the sub. Question: Why is zero being seen as False?? Can VBA be that binarily pedantic? In which case, how can I accept one entering a zero?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules