|  

» 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




Rate This Tip
12 34 5
Rating: 2.38     Views: 20243
No comments have been submitted.
Click here to post comment
For Registered Users
Name
Comment Title
Comments