Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tudo que estiver relacionado ao Excel básico, como somar, calcular média, colocar bordas, etc.
  • Avatar do usuário
Por Ruka
#48930
Boa tarde.

Gostaria de saber como formato uma coluna para inserir matriculas de viaturas

ex:
AA-AA-AA - ficar com este formato no excel
Por kiko
Posts
#48942
Ruka boa tarde, SUPONDO que os dados estão na COLUNA "B", insira esse código na planilha que pretende fazer essa formatação.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Ponta As String
Dim Meio As String
Dim Fim As String

Application.EnableEvents = False
'Trata o campo XX-XX-XX
'----------------------------
If Target.Column = 2 Then

Ponta = Left(Target.Value, 2)
Meio = Mid(Target.Value, 3, 2)
Fim = Right(Target.Value, 2)

'Deixa as 6 letras em maiúsculas + "-"
Target.Value = UCase(Ponta) & "-" & UCase(Meio) & "-" & UCase(Fim)
End If

Application.EnableEvents = True

End Sub


Depois é só digitar 6(seis) letras em qualquer célula da coluna B que ficará assim:
Trata o campo XX-XX-XX

Caso tenha te ajudado de alguma forma, favor clicar no OBRIGADO como forma de agradecimento.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord