Method which converts number string into timevalue.
First set range's cell format to "mm:ss.00"
In Standard Module.
Function ConvertToTimeVal(myVal As Long) As Double
Dim myStr As String
Dim myMin As Double, mySec As Double, myMili As Double
myStr = Format(myVal, "000000")
myMin = CDbl(Left(myStr, 2)) * 60 * 1000
mySec = CDbl(Mid(myStr, 3, 2)) * 1000
myMili = CDbl(Right(myStr, 2)) * 10
ConvertToTimeVal = (myMin + mySec + myMili) / 1000 / 24 / 60 / 60
End Function
Then in Worksheet module (Change range as needed).
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("B2:B100")) Is Nothing Then
If Target.Value = "" Then Exit Sub
Application.EnableEvents = False
Target.Value = ConvertToTimeVal(Target.Value)
Application.EnableEvents = True
End If
End Sub
See attached.
Note: Not fully tested. If you find issue, let me know.
Bookmarks