Time and Date Entry Shortcuts?

  • Thread starter Thread starter Tammy
  • Start date Start date
T

Tammy

Anyone know of a way to enter times and dates without hyphens or colons?
Would like to 10-key a six-digit date and 10-key a four-digit time without
keying in the hyphens, dashes, or colons? Please advise when you can.
Thanks so much!
 
Hi Tammy,

You might be able to do this with VBA if you always enter the dates and
times in a given location in the spreadsheet.

Of course if the date is the current date you can press Ctrl+; (control
semicolon)
And if the time is now you can press Ctrl+: (control colon --> control shift
semicolon)

Here is the code:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Set isect = Application.Intersect(Range("DateTime"), Target)
If Not isect Is Nothing Then
If Len(Target) = 6 Then
Target = Left(Target, 2) & "/" & Mid(Target, 3, 2) & "/" &
Right(Target, 2)
ElseIf Len(Target) = 5 Then
Target = Left(Target, 1) & "/" & Mid(Target, 2, 2) & "/" &
Right(Target, 2)
ElseIf Len(Target) = 4 Then
Target = Left(Target, 2) & ":" & Right(Target, 2)
Else
Target = Left(Target, 1) & ":" & Right(Target, 2)
End If
End If
Application.EnableEvents = True
End Sub
 
I used to enter datecodes as
200801021423 (formatted as text)
This broke out to
Year= 2008
Month=01
Day = 02
Time=1423 (Military time for 2:23pm)

Vaya con Dios,
Chuck, CABGx3
 
How do I add multple events in one Worksheet. ie..I want the date in column
A, time change in column B and H.

Thanks,
 
Back
Top