View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Leith Ross
 
Posts: n/a
Default format a six figure number to a time.


Hello Ade,

You need to use string functions to break the time code apart since
this a non-standard Excel format for time.

VBA EXAMPLE:
Dim H, M, S
Dim TimeCode As String

TimeCode = "105306"
H = Left(TimeCode, 2) & ":"
M = Mid(TimeCode,3, 2) & ":"
S = Right(TimeCode, 2)

Range("A1") = H & M & S

A1 will display 10:53:06

There are equivalent Worksheet Functions to do this also.

WORKSHEET FORMULA EXAMPLE:
A1 = 105306
B1 contains the formula =LEFT(A1, 2) & ":" & MID(A1, 3, 2) & ":" &
RIGHT(A1, 2)

B1 will display 10:53:06

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=503554