Guru do Excel + Power BI

Sua dose diária de Power BI e Excel

Tópicos relacionados a códigos VBA, gravação de macros, etc.
Por osvaldomp
#73085
Disponibilize o arquivo Excel com a TextBox.
Por osvaldomp
#73087
FÓRUM ZUADO DE NOVO! NÃO ACEITA FORMATAÇÃO DE TEXTO, NÃO ACEITA INSERÇÃO DE CODE, NÃO ACEITA "OBRIGADO".

Private Sub TextBox1_Change()
If TextBox1.Text = "" Then Exit Sub
If Len(TextBox1.Text) <= 4 Then
If Not Right(TextBox1.Text, 1) Like "[a-zA-Z]" Then 'aceita letras minúsculas e maiúsculas
TextBox1.Text = Left(TextBox1.Text, Len(TextBox1.Text) - 1)
End If
ElseIf Len(TextBox1.Text) = 5 Then
If Not Right(TextBox1.Text, 1) Like "[0-9]" Then
TextBox1.Text = Left(TextBox1.Text, Len(TextBox1.Text) - 1)
End If
Else: TextBox1.Text = Left(TextBox1.Text, Len(TextBox1.Text) - 1)
End If
End Sub

"[A-Z]" ~~~> aceita somente maiúsculas
Por PedroBB
Posts
#73089
osvaldomp escreveu: 23 Mar 2023 às 11:19 FÓRUM ZUADO DE NOVO! NÃO ACEITA FORMATAÇÃO DE TEXTO, NÃO ACEITA INSERÇÃO DE CODE, NÃO ACEITA "OBRIGADO".

Private Sub TextBox1_Change()
If TextBox1.Text = "" Then Exit Sub
If Len(TextBox1.Text) <= 4 Then
If Not Right(TextBox1.Text, 1) Like "[a-zA-Z]" Then 'aceita letras minúsculas e maiúsculas
TextBox1.Text = Left(TextBox1.Text, Len(TextBox1.Text) - 1)
End If
ElseIf Len(TextBox1.Text) = 5 Then
If Not Right(TextBox1.Text, 1) Like "[0-9]" Then
TextBox1.Text = Left(TextBox1.Text, Len(TextBox1.Text) - 1)
End If
Else: TextBox1.Text = Left(TextBox1.Text, Len(TextBox1.Text) - 1)
End If
End Sub

"[A-Z]" ~~~> aceita somente maiúsculas
Sensacional!!!!
Muito obrigado, Osvaldo!

Valeu. Muito Obrigado!!!!!!!!

Pessoal, Ao clicar no botão Copiar (Guia C[…]

Boa noite. Implementei em minha planilha a condi&c[…]

One night stands, no obligations.

Consensual free relationships Real Women

Procv com serro em vba

Resolvido

Embrace the freedom of casual encounters on the be[…]

Secret meetings: just for two, one night only

Turn casual moments into unforgettable dates &ndas[…]

Bom dia, pessoal! com a data de nascimento e data […]