Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Time with entering data in the corresponding cell Amit Kumar Baidyaka Excel Discussion (Misc queries) 3 March 10th 08 12:22 PM
Entering a random date and time in a cell Dermot Excel Discussion (Misc queries) 1 August 19th 06 03:35 PM
How to mark down the time when entering input to a cell? Eric Excel Worksheet Functions 1 June 8th 06 03:04 AM
How to mark down the time when entering input to a cell? Eric Excel Discussion (Misc queries) 1 June 8th 06 03:03 AM
Formula is entering a default time when it comes across an empty cell.. Howie Excel Worksheet Functions 10 November 16th 05 11:34 AM


All times are GMT +1. The time now is 08:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"