Calculations with one thousandth fractions of seconds by Custom Function using VBA

Question: Calculations with values in the area of tenthousandth of a second
are to be done

Answer: Insert the following code in the appropriate modules. With the following user defined function. syntax: =spectime(A1)

Place the code below into the standard module

Function SpecTime(txt As String)
   Const DIV As Long = 86400
   Dim dblValue As Double
   dblValue = CInt(Right(txt, 4)) / (DIV * 10000)
   dblValue = dblValue + CInt(Mid(txt, 4, 2)) / DIV
   dblValue = dblValue + CInt(Left(txt, 2)) / (DIV / 60)
   SpecTime= dblValue
End Function

Leave a Reply

Your email address will not be published. Required fields are marked *

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.