View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default HOW DO YOU SET THE DEFAULT TIME FOR DATE IN EXCEL TO 8:00 AM?

And that means that you're using ctrl-; (semi-colon--not colon, right???)

I don't think you can change that behavior, but you can avoid it!

You could use a macro and assign it to a shortcut key so that the macro runs.

I couldn't use ctrl-; in the tools|macro|options dialog, but I could assign it
via code.

I'd add something like this to my Personal.xls workbook.

Option Explicit
Sub Auto_open()
Application.OnKey "^;", ThisWorkbook.Name & "!CtrlSemiColon"
End Sub
Sub Auto_Close()
Application.OnKey "^;"
End Sub
Sub CtrlSemiColon()
On Error Resume Next
With Selection
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
.Value = Date + TimeSerial(8, 0, 0)
End With
If Err.Number < 0 Then
MsgBox "Date/Time not inserted"
Err.Clear
End If
On Error GoTo 0
End Sub

Change the date/time format to what you want.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm




David wrote:

I have changed the format for my column to show date with time.
the default time is always 12:00 AM.

Is there any way to change this default time to 8:00 AM?

"Dave Peterson" wrote:

Ctrl-: puts the current time in the cell--there is no default.

David wrote:

I would prefer to have the default time be 8:00 am rather than 12:00 AM when
I use the ctrl : shortcut.
Anyone know how to do this?


--

Dave Peterson


--

Dave Peterson