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

Dúvidas sobre cálculos, funções simples e aninhadas, fórmulas matriciais, etc.
Por Inovacao
#53436
Pessoal boa tarde.
Tudo bem?

Eu tenho uma planilha para controle de horas:
Eu queria que ao digitar 09 ele convertesse automaticamente para 09:00.
Auguem consegue isso com fórmulas?

Alguém consegue me ajudar?

Segue Planilha

Obrigado.
Você não está autorizado a ver ou baixar esse anexo.
Por babdallas
#53474
Com fórmula: usando coluna auxiliar.
Sem formula: VBA.

O que prefere?
Por Inovacao
#53485
Boa tarde.

Para o meu uso eu prefiro com fórmula pois não tenho pratica com VBA.
Porem se voce puder fazer os dois modelos, assim posso usar seu VBA afim de estudos.


Obrigado.
Por osvaldomp
#53515
Veja se as sugestões do link abaixo podem ser úteis.

viewtopic.php?f=12&t=11815
Por osvaldomp
#53537
Experimente:
Código: Selecionar todos
Private Sub Worksheet_Change(ByVal Target As Range)
 If Target.Count > 1 Then Exit Sub
 If Target.Value = "" Or Target.Column <> 4 Or Not IsNumeric(Target.Value) Then Exit Sub
  On Error GoTo fim
  Application.EnableEvents = False
  Select Case Len(Target.Value)
   Case 1: Target.Value = "00:0" & Target.Value
   Case 2: Target.Value = "00:" & Target.Value
   Case Else: Target.Value = Left(Target.Value, Len(Target.Value) - 2) _
     & ":" & Right(Target.Value, 2)
   End Select
fim:
  Application.EnableEvents = True
End Sub
Por babdallas
#53554
Uma opção com fórmulas e coluna, apesar de achar que neste caso o VBA seria melhor.

Se achar que resolver seu problema, favor marcar o tópico como concluído.
Você não está autorizado a ver ou baixar esse anexo.
Por Inovacao
#53559
Bom dia a todos!!

Deu certo a coluna auxiliar.

Tentei colar o código na planilha e não consegui, apertei ALT+F11 e colei mas não funcionou.

Se alguém souber me explicar

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Value = "" Or Target.Column <> 4 Or Not IsNumeric(Target.Value) Then Exit Sub
On Error GoTo fim
Application.EnableEvents = False
Select Case Len(Target.Value)
Case 1: Target.Value = "00:0" & Target.Value
Case 2: Target.Value = "00:" & Target.Value
Case Else: Target.Value = Left(Target.Value, Len(Target.Value) - 2) _
& ":" & Right(Target.Value, 2)
End Select
fim:
Application.EnableEvents = True
End Sub

Segue Planilha que anexei o código

Obrigado.
Você não está autorizado a ver ou baixar esse anexo.
Por osvaldomp
#53561
O código que passei funciona somente na coluna D. Se você quer que funcione em outras colunas, então informe quais.
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