urgent : count of digits in a number
This function calculates the length of a number:
Function NLength(ByVal MyNum As Double) As Integer
Select Case Sgn(MyNum)
Case Is = 1
NLength = 1 + Int(Log(MyNum) / Log(10))
Case Is = 0
NLength = 1
Case Is = -1
NLength = 2 + Int(Log(Abs(MyNum)) / Log(10))
End Select
End Function
HOWEVER, this omits the fractional part: if you know the precision to which
you want to show the number, add 1 + the number of digits after the decimal
point to the result.
"SHIRA" wrote:
i need a function or a macro that calculates the count of digits in a number
|