Eliézer7
25-10-2014 19:27:50
Possuo o código abaixo que faz alguns bloqueios ao digitar em um TextBox, o problema é que isso precisa ser executado em vários TextBox(não em todos) e eu não queria ter que repetir o código em todos os TextBox, alguem consegue me ajudar ?
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'Permite que seja digitado "," apenas uma vez
If KeyAscii = 44 And InStr(UserForm1.TextBox1.Text, ",") <> 0 Then
KeyAscii = 0
End If
'Não permite letras e ponto.
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 And KeyAscii <> 44 Then
KeyAscii = 0
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
'Permite que seja digitado "," apenas uma vez
If KeyAscii = 44 And InStr(UserForm1.TextBox1.Text, ",") <> 0 Then
KeyAscii = 0
End If
'Não permite letras e ponto.
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 And KeyAscii <> 44 Then
KeyAscii = 0
End If
End Sub