How to enter current static time in Excel in 00:00:00.0 format?

G

Guest

I am using ctrl+shift+; to enter a static time in a spreadsheet but that only
gives hours & minutes without seconds and decimals. I need to have seconds
and decimal. Any thoughts?
 
J

JE McGimpsey

One way:

Put this macro in your Personal.xls or other startup workbook. Attach it
to a toolbar button, or give it a keyboard shortcut.

Public Sub ExtendedTime()
If TypeOf Selection Is Range Then
With ActiveCell
.NumberFormat = "hh:mm:ss"
.Value = Time
End With
End If
End Sub
 
D

David McRitchie

You would have to create a macro, the easiest form of macro for this
would be an event macro. You could trigger it on replacing an empty
cell in a specific column, or when another column is filled in.


DateTimeStamp in Column A, on first entry in any other column on row (#datetimestamp)
http://www.mvps.org/dmcritchie/excel/event.htm#datetimestamp

Place current date constant in Column A when Column B changes (#autodate)
http://www.mvps.org/dmcritchie/excel/event.htm#autodate

The following will put the time into Column B when an entry is made in Column A
install by right click on sheet tab, View code, .place the following code there

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1Then Exit Sub
If Target.Row = 1 Then Exit Sub
If IsEmpty(Target.Offset(0, 1)) Then
Target.Offset(0, 1) = Time
Target.offset(0, 1).numberformat = "hh:mm:ss.00"
End If
End Sub
 
G

Guest

Thanks. That did it.
Wayne

David McRitchie said:
You would have to create a macro, the easiest form of macro for this
would be an event macro. You could trigger it on replacing an empty
cell in a specific column, or when another column is filled in.


DateTimeStamp in Column A, on first entry in any other column on row (#datetimestamp)
http://www.mvps.org/dmcritchie/excel/event.htm#datetimestamp

Place current date constant in Column A when Column B changes (#autodate)
http://www.mvps.org/dmcritchie/excel/event.htm#autodate

The following will put the time into Column B when an entry is made in Column A
install by right click on sheet tab, View code, .place the following code there

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1Then Exit Sub
If Target.Row = 1 Then Exit Sub
If IsEmpty(Target.Offset(0, 1)) Then
Target.Offset(0, 1) = Time
Target.offset(0, 1).numberformat = "hh:mm:ss.00"
End If
End Sub
 

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