kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
Code:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
With TextBox1
If InStr(.Text, ".") > 0 Then
If Len(Split(.Text, ".")(1)) = [COLOR=#ff0000]2[/COLOR] Then KeyAscii = 0
End If
Select Case KeyAscii
Case Asc("0") To Asc("9")
Case Asc("."): If UBound(Split(.Text, ".")) = [B][COLOR=#006400]1[/COLOR][/B] Then KeyAscii = 0
Case Else: KeyAscii = 0
End Select
End With
End Sub
Can it be that after the two decimal places achieved I can still change the whole number part part not the DecimalPart?
That's when I am adding to the left part of the ".", allow me.
But to the right, don't.
Thanks