Public Function FormatTime(ByVal sglTime As Single) As String
' Determine how to display the time Select Case sglTime Case 0 To 59' Seconds FormatTime = Format(sglTime, "0") & " sec" Case 60 To 3599 ' Minutes Seconds FormatTime = Format(Int(sglTime / 60), "#0") & _ " min " & _ Format(sglTime Mod 60, "0") & " sec" Case Else' Hours Minutes FormatTime = Format(Int(sglTime / 3600), "#0") & _ " hr " & _ Format(sglTime / 60 Mod 60, "0") & " min" End Select End Function "FormatTime(1)" returns "1 sec" "FormatTime(65)" returns "1 min 5 sec" "FormatTime(5000)" returns "1 hr 23 min" |