Entering Times

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.
 
B

Bob Phillips

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top