View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default keyboard shortcut for dates and Time

You could use:
ctrl-;, spacebar, ctrl-:

You could use a macro to enter the time including seconds.

Saved from a previous post:

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

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

========
And for xl2007, you'd use an extension of .xlsm (personal.xlsm or personal.xlam
for an addin).

rexmann wrote:

Hi All

I know the keyboard short cut for date (Ctrl ;) and for time (ctrl shift ;)

Is there a short cut to enter date and time together

Equally is there a shortcut to enter the time in hh, mins and seconds
(reading from the computers clock)? when I use ctrl shift and ; it just does
hh and mm (even if set to hh mm and seconds

Any help greatly appreciated

Cheers Rexmann


--

Dave Peterson