Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Entering the time in a cell
How do it enter in a single digit for time but have it displayed at full
time. For example if I type in the number 8 how to I get it to display 8:00? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Entering the time in a cell
It won't be a true time value, but you can get the appearance by formatting
cell: 0":00" -- Best Regards, Luke M *Remember to click "yes" if this post helped you!* "Hezzy" wrote: How do it enter in a single digit for time but have it displayed at full time. For example if I type in the number 8 how to I get it to display 8:00? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Entering the time in a cell
There is nothing built in but with a little VBA as described here it is
possible... http://www.cpearson.com/excel/DateTimeEntry.htm -- HTH... Jim Thomlinson "Hezzy" wrote: How do it enter in a single digit for time but have it displayed at full time. For example if I type in the number 8 how to I get it to display 8:00? |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Entering the time in a cell
Hi,
Here is some rather more complex code which you can cut down to what you need: Private Sub Worksheet_Change(ByVal Target As Range) Dim I As Integer Set isect = Application.Intersect(Target, Range("Time")) If isect Is Nothing Then Exit Sub 'not inside the desired range If Target.Count 1 Then Exit Sub 'more than one cell selected Application.EnableEvents = False 'Numeric entries If Target = 1 Then If Len(Target) = 1 Then Target = Target & " AM" ElseIf Len(Target) = 2 Then If Target <= 12 Then Target = Target & " AM" Else Target = Target - 12 & " PM" End If ElseIf Len(Target) = 3 Then Target = Left(Target, 1) & ":" & Right(Target, 2) Application.EnableEvents = True Exit Sub ElseIf Len(Target) = 4 Then Target = Format(Left(Target, 2) & ":" & Right(Target, 2), "HH:MM AM/PM") Application.EnableEvents = True Exit Sub Else MsgBox "That entry is not a legal time." Target.ClearContents Application.EnableEvents = True Exit Sub End If End If End If Application.EnableEvents = True End Sub -- If this helps, please click the Yes button. Cheers, Shane Devenshire "Hezzy" wrote: How do it enter in a single digit for time but have it displayed at full time. For example if I type in the number 8 how to I get it to display 8:00? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Time with entering data in the corresponding cell | Excel Discussion (Misc queries) | |||
Entering a random date and time in a cell | Excel Discussion (Misc queries) | |||
How to mark down the time when entering input to a cell? | Excel Worksheet Functions | |||
How to mark down the time when entering input to a cell? | Excel Discussion (Misc queries) | |||
Formula is entering a default time when it comes across an empty cell.. | Excel Worksheet Functions |