RP1America
Technical User
Hi! I'm looking to restrict userform (textbox) entry to only quarter decimals (.25, .50, .75, 1, 1.25, etc.).
I currently have the following code:
There are two things that I need to happen...
1) Only allow input of quarter decimals (as explained above).
2) Be able to have an entry of ".25". Currently, I am unable to enter a "." first before any digits. So user would have to enter "0.25", yet I would like for them to simply enter ".25" when under an hour.
Thanks in advance!!
Ryan
I currently have the following code:
Code:
Private Sub txtTime_Exit(ByVal Cancel As MSForms.ReturnBoolean)
txtTime.Text = Format(CDec(txtTime.Text), "0.00")
End Sub
Code:
Private Sub txtTime_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc("0") To Asc("9")
Case Asc(".")
If InStr(1, Me.txtTime.Text, ".") > 0 Then
KeyAscii = 0
End If
Case Else
KeyAscii = 0
End Select
End Sub
There are two things that I need to happen...
1) Only allow input of quarter decimals (as explained above).
2) Be able to have an entry of ".25". Currently, I am unable to enter a "." first before any digits. So user would have to enter "0.25", yet I would like for them to simply enter ".25" when under an hour.
Thanks in advance!!
Ryan