Insert time into a cell with seconds?

  • Thread starter Thread starter mike EA4347
  • Start date Start date
M

mike EA4347

I am trying to insert a "timestamp" into a cell using ctrl+shift+;an
want hh:mm:ss format.
If I format the cell in hh:mm:ss the seconds always is 00. It appear
that when I ctrl+shift+; excel truncates the system time to hh:mm. I
there a way around this or another way to get the seconds into a
"insert time" command
 
Try this simple macro. Assign it to keyboard shortcut of
Ctrl+Shift+T and it should do what you are looking for by
inserting the time in the active cell.

Sub Time_Stamp()
' Keyboard Shortcut: Ctrl+Shift+T
ActiveCell.Value = Now()
Selection.NumberFormat = "h:mm:ss"
End Sub
 
Mike

It seems the default is for Excel to use the hh:mm:00 format when using the
shortcut mehtod.

This small macro on a button will enter the seconds also.

Sub NOWTIME()
ActiveCell.Value = Format(Now(), "h:mm:ss AM/PM")
End Sub

Copy/paste it to a general module and assign it to a button or shortcut combo.

Gord Dibben XL2002
 
Back
Top