ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to enter current static time in Excel in 00:00:00.0 format? (https://www.excelbanter.com/excel-worksheet-functions/25698-how-enter-current-static-time-excel-00-00-00-0-format.html)

Wlumkong

How to enter current static time in Excel in 00:00:00.0 format?
 
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?

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

In article ,
"Wlumkong" wrote:

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?


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

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Wlumkong" wrote in message ...
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?




Wlumkong

Thanks. That did it.
Wayne

"David McRitchie" wrote:

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

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Wlumkong" wrote in message ...
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?






All times are GMT +1. The time now is 09:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com