Entering Times

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a spread sheet where there are a lot of times that are entered. Is
there a way to format the cells so that when you type in the time you do not
have to use the shift key and the colon. I would like to be able to just type
in 1320 and the colon be inserted automatically.

Thanks.
 
You need code to translate it

Private Sub Worksheet_Change(ByVal Target As Range)


Application.EnableEvents = False
On Error GoTo ws_exit
If Target.Column = 8 Then
With Target
.Value = TimeSerial(.Value \ 100, _
.Value - (.Value \ 100) * 100, _
0)
End With
End If


ws_exit:
Application.EnableEvents = True
End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
 
Back
Top