Insert time into a cell with seconds?

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
 
J

JerryG

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
 
G

Gord Dibben

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
 

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