Maybe:
Option Explicit
Function fCnvTime(ByRef cell As Range)
' example VBA call: MsgBox fCnvTime(Range("A3"))
' example WS call: =fcnvtime(A3)
Dim vArray
Dim lMin As Long, lSec As Long, lMS As Long, i As Long
Dim sTime As String
On Error Resume Next
If Right(cell, 1) = Chr(160) Then cell = Left(cell, Len(cell) - 1)
vArray = Split(Trim(cell.Value))
lMin = 0: lSec = 0: lMS = 0
For i = LBound(vArray) To UBound(vArray)
If LCase(Right(vArray(i), 2)) = LCase("Mn") Then
lMin = lMin + --Left(vArray(i), Len(vArray(i)) - Len("Mn"))
GoTo lblNext
End If
If LCase(Right(vArray(i), 2)) = LCase("ms") Then
lMS = lMS + --Left(vArray(i), Len(vArray(i)) - Len("ms"))
lSec = lSec + Round(lMS / 1000, 0)
GoTo lblNext
End If
If LCase(Right(vArray(i), 1)) = LCase("s") Then
lSec = lSec + --Left(vArray(i), Len(vArray(i)) - Len("s"))
GoTo lblNext
End If
lblNext:
Next 'i
sTime = lMin & ":" & lSec
fCnvTime = TimeValue(sTime)
On Error GoTo 0
End Function
Sub test()
MsgBox fCnvTime(Range("A3"))
End Sub
Regards, TMS
Bookmarks