Thread: Time format
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Time format

I've added a macro to my personal.xl* file that steals the ctrl-shift-colon
function and replaces it with what I want.

Saved from a previous post:

If you want to try, create a workbook that includes this code and store it in
your XLStart folder. Lots of people use a workbook named Personal.xls for this
kind of thing.

Option Explicit
Sub Auto_Open()
Application.OnKey "+^:", "'" & ThisWorkbook.Name & "'!Nowtime"
End Sub
Sub Auto_Close()
Application.OnKey "+^:"
End Sub
Sub NowTime()
On Error Resume Next
With Selection
.Value = Now
.NumberFormat = "hh:mm:ss"
End With
If Err.Number < 0 Then
Beep
Err.Clear
End If
On Error Goto 0
End Sub


If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

clcnewtoaccess wrote:

I have formatted my cells as 12:00:00, but when I do a ctrl+shift+: it always
shows the seconds as 00 (example 10:37:00 should be 10:37:18). I have tried
all of the time formats that look like what I need but nothing works. This
is being done on a HP Jornada pocket PC.
Any Ideas?
--
clcnewtoaccess


--

Dave Peterson