inactiveUser214710
Board Regular
- Joined
- Apr 27, 2012
- Messages
- 171
Hello everyone
I have 4 textbox used only for values(numbers-cash).
I use the code below for each textbox.
Is it possible to elaborate a macro, and how, to avoid repeating the codes for each textbox?
Thank you for your cooperation.
I have 4 textbox used only for values(numbers-cash).
I use the code below for each textbox.
Is it possible to elaborate a macro, and how, to avoid repeating the codes for each textbox?
Thank you for your cooperation.
Code:
Private Sub TextBox4_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'Only Numbers in textbox or simples signs
Select Case KeyAscii
Case Asc("0") To Asc("999")
Case Asc(".")
If InStr(1, TextBox4.Value, ".") > 0 Then
KeyAscii = 0
End If
Case Asc(",")
If InStr(1, TextBox4.Value, ",") > 0 Then
KeyAscii = 0
End If
Case Else
KeyAscii = MsgBox("SORRY! Introduce just Price numbers")
End Select
End Sub