inactiveUser214710
Board Regular
- Joined
- Apr 27, 2012
- Messages
- 171
Hi everybody
I have a userform in vba with 3 text boxes to put only numbers and signs, and 2 text boxes to fill with numbers or letters (descriptions).
How can I separate them, as to their respective functions, using perhaps a general code in a module. Is this possible?
In my case I use these codes for each number text box.
for example:
I would like to simplify that in a module or in a class module, for textbox of numbers, and another for textbox with different writing (numbers and letters). will that be possible or am I exaggerating with my pretensions?
In my userform I have (txtv1; txtv2; txtvT) to enter numbers and signs (monetary values) and (txtOb1; txtOb2) to enter letters and numbers.
Thank you in advance, for anyone who can help me in this problem.
Thanks again.
Jdcar
I have a userform in vba with 3 text boxes to put only numbers and signs, and 2 text boxes to fill with numbers or letters (descriptions).
How can I separate them, as to their respective functions, using perhaps a general code in a module. Is this possible?
In my case I use these codes for each number text box.
for example:
VBA Code:
Private Sub txtvt_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) 'txtv1;txtv2;txtvt
Select Case KeyAscii
Case Asc("0") To Asc("999")
Case Asc(".")
If InStr(1, txtvt.Value, ".") > 0 Then
KeyAscii = 0
End If
Case Asc(",")
If InStr(1, txtvt.Value, ",") > 0 Then
KeyAscii = 0
End If
Case Else
KeyAscii = MsgBox("SORRY! Introduce just Price numbers")
End Select
End Sub
I would like to simplify that in a module or in a class module, for textbox of numbers, and another for textbox with different writing (numbers and letters). will that be possible or am I exaggerating with my pretensions?
In my userform I have (txtv1; txtv2; txtvT) to enter numbers and signs (monetary values) and (txtOb1; txtOb2) to enter letters and numbers.
Thank you in advance, for anyone who can help me in this problem.
Thanks again.
Jdcar