Function Sec2Min(TheSecs As Long)
On Error Goto FixMin Dim Secz As String Secz = "0" If TheSecs > 59 Then If Replace(TheSecs / 60, Mid(TheSecs / 60, _ InStr(TheSecs / 60, ".")), "") > 9 Then Secz = "" If TheSecs - Replace(TheSecs / 60, Mid(TheSecs / 60, _ InStr(TheSecs / 60, ".")), "") * 60 < 10 Then Sec2Min = Secz & CStr(Replace(TheSecs / 60, _ Mid(TheSecs / 60, InStr(TheSecs / 60, ".")), "") & _ ":0" & TheSecs - Replace(TheSecs / 60, Mid(TheSecs / _ 60, InStr(TheSecs / 60, ".")), "") * 60) Else Sec2Min = Secz & CStr(Replace(TheSecs / 60, _ Mid(TheSecs / 60, InStr(TheSecs / 60, ".")), "") & _ ":" & TheSecs - Replace(TheSecs / 60, Mid(TheSecs / _ 60, InStr(TheSecs / 60, ".")), "") * 60) End If Else If TheSecs < 10 Then Sec2Min = "00:" & "0" & TheSecs Else Sec2Min = "00:" & TheSecs End If End If Exit Function FixMin: If Secz = "" Then Sec2Min = Mid(TheSecs / 60, 1, 1) & ":00" Else Sec2Min = "0" & Mid(TheSecs / 60, 1, 1) & ":00" End If End Function 'Es. Msgbox Sec2Min(795) o Text1 = Sec2Min(795) |