HH:MM code
Posted by May on July 12, 2000 8:28 AM
How can you change this code to look into say column C and change all numbers in Column D to the HH:MM format i.e. inserting the :
This code only does Column A
Cheers
May
Dim Time As String
Dim x As Integer
Application.ScreenUpdating = False
x = 0
Do
x = x + 1
Time = Cells(x, 1).Value
If Len(Time) > 3 Then
Cells(x, 2).Value = Left(Time, 2) & ":" & Right(Time, 2)
ElseIf Len(Time) = 3 Then
With Cells(x, 2)
.Value = "0" & Left(Time, 1) & ":" & Right(Time, 2)
.NumberFormat = "hh:mm"
End With
End If
Loop While Cells(x + 1, 1).Value <> ""
Application.ScreenUpdating = True