Convert to hrs:min

D

da

hello
Is there any way to convert the following numbers to show as hrs:min without
manually insterting a colon?
e.g.15:45 18:40

1545 1840
2015 2300
2045 2105
1700 1815
1825 1840
1850 2000
1835 1900
 
G

Gary''s Student

Select the cells you want to convert and run this little macro:

Sub marine()
Dim hrs As Integer, mins As Integer
For Each r In Selection
v = r.Value
hrs = Left(v, 2)
mins = Right(v, 2)
r.Clear
r.NumberFormat = "hh:mm"
r.Value = TimeSerial(hrs, mins, 0)
Next
End Sub
 
D

da

Thank you for your suggestion. I am not good at runnung macros.
But I found another formula that worked.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top