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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.