Assuming you want the time to display in 12hr format:
1:15 PM
1:15 AM
11:30 PM
11:30 AM
Either comment out or delete these lines of the code:
Change this line of code:![]()
Case 5 ' e.g., 12345 = 1:23:45 NOT 12:03:45 TimeStr = Left(.Value, 1) & ":" & _ 'Mid(.Value, 2, 2) & ":" & Right(.Value, 2) Case 6 ' e.g., 123456 = 12:34:56 TimeStr = Left(.Value, 2) & ":" & _ Mid(.Value, 3, 2) & ":" & Right(.Value, 2)
To:![]()
.Value = TimeValue(TimeStr)
![]()
.Value = Format(TimeValue(TimeStr), "h:mm am/pm")
Bookmarks