Count The Number Of Digits In A Number

'Insert the following code to your form:

Private Function GetDigitCount(inValue As Double) As Double
GetDigitCount = Int(Log(inValue) / Log(10)) + 1
End Function

Private Sub Form_Load()
'Replace '123456789' with the number you want to count its digits
MsgBox GetDigitCount(123456789)
End Sub

Go Back