Experts Exchange connects you with the people and services you need so you can get back to work.
Public Sub FixTimes()
Dim c As Excel.Range
Dim rngLook As Excel.Range
Dim strTime As String
' get the used part of column A, excluding the first row
Set rngLook = Application.Intersect(Range("A:A"), ActiveSheet.UsedRange)
Set rngLook = rngLook.Offset(1, 0).Resize(rngLook.Rows.Count - 1, 1)
For Each c In rngLook.Cells
strTime = c.Value2
strTime = String(8 - Len(strTime), "0") & strTime
' only do eight character fields
strTime = Mid(strTime, 1, 2) & ":" & _
Mid(strTime, 3, 2) & ":" & _
Mid(strTime, 5, 2) & "." & _
Mid(strTime, 7, 2)
c.Value2 = strTime
rngLook.NumberFormat = "hh:mm:ss.00"
Open in new window
An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.
One of a set of tools we're offering as a way of saying thank you for being a part of the community.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Premium members get this course for $159.20.
Premium members get this course for $95.20.
Premium members get this course for $167.20.
Premium members get this course for $31.25.
Premium members get this course for $389.00.
Premium members get this course for $122.40.