View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_298_] Leith Ross[_298_] is offline
external usenet poster
 
Posts: 1
Default Minutes to seconds


Hello Partysquad,

Add a VBA module to your project. Copy the following code into it. On
the worksheet use it like any other formula.

Example:
Cell C10 = "6:08.74"
Cell C11 =TotalSeconds(C10)


Code:
--------------------

Public Function TotalSeconds(Cell As Range)

Application.Volatile

Dim I As Long
Dim TimeStr As String
Dim X

TimeStr = Cell.Value
I = InStr(1, TimeStr, ":")

If I 0 Then
X = Val(Left(TimeStr, I - 1)) * 60
X = X + Val(Right(TimeStr, Len(TimeStr) - I))
Else
X = 0
End If

TotalSeconds = X

End Function

--------------------

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=487040