Time and Date Entry Shortcuts?
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
--
cheers,
Shane Devenshire
"Tammy" wrote:
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!
|