Edu
01-08-2011 14:48:50
Ola teria como fazer uma macro ou funcao para que um textbox so aceite numeros seguido de "."(ponto) ou ","(virgula)
se houver ficarei muito grato
se houver ficarei muito grato
Edu
01-08-2011 14:48:50
JValq
01-08-2011 15:17:43
Código: Selecionar todos
Private Sub TextBox1_Change()
If Not IsNumeric(TextBox1.Text) Then TextBox1.Text = Empty
End Sub
geroeane
04-08-2011 22:57:27
Melo
04-08-2011 23:37:51
Mauro Coutinho
09-08-2011 02:28:00
Pedro Jhonata
02-10-2016 06:19:11
Melo escreveu:Boa noite
Estou usando em meu projeto o seguinte para aceitar somente Numeros
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Dim strValid As String
strValid = "0123456789"
If InStr(strValid, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
' ESTE A BAIXO É PARA ESPECIFICAR QUE A CADA 3 NUMEROS COLOCAR UM TRAÇO (-) E DEPOIS MAIS 4
If Len(txtPlaca) = 3 Or Len(txtPlaca) = 4 Then
txtPlaca.Text = txtPlaca.Text & "-"
SendKeys "{End}", True
End If
Aproveito para PERGUNTAR
Como ficaria para digitar em uma TextBox uma placa, ex: Obrigar a Digitar somente (3) Letras e gerar o Traço (-) e depois aceitar os 4 numeros.
Como ficaria?
Thigodoy
01-10-2019 16:21:26
Melo escreveu: ↑Qui Ago 04, 2011 8:37 pm Boa noite
Estou usando em meu projeto o seguinte para aceitar somente Numeros
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Dim strValid As String
strValid = "0123456789"
If InStr(strValid, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
' ESTE A BAIXO É PARA ESPECIFICAR QUE A CADA 3 NUMEROS COLOCAR UM TRAÇO (-) E DEPOIS MAIS 4
If Len(txtPlaca) = 3 Or Len(txtPlaca) = 4 Then
txtPlaca.Text = txtPlaca.Text & "-"
SendKeys "{End}", True
End If
Aproveito para PERGUNTAR
Como ficaria para digitar em uma TextBox uma placa, ex: Obrigar a Digitar somente (3) Letras e gerar o Traço (-) e depois aceitar os 4 numeros.
Como ficaria?