Skip to main content

Posts

Showing posts with the label Number to Text in Excel that can handle more than 3 decimal places

Number to Text in Excel that can handle more than 3 decimal places

follow the instructions from my previous post . paste the following code instead of the new one. Option Explicit '**************** ' Main Function * '**************** Function SpellNumber(ByVal MyNumber) Dim Temp, WholeNumberText, DecimalText Dim DecimalPlace, Count ReDim Place(9) As String Place(2) = " Thousand " Place(3) = " Million " Place(4) = " Billion " Place(5) = " Trillion " ' String representation of amount. MyNumber = Trim(Str(MyNumber)) ' Position of decimal place 0 if none. DecimalPlace = InStr(MyNumber, ".") ' Convert cents and set MyNumber to dollar amount. If DecimalPlace > 0 Then DecimalText = Left(Mid(MyNumber, DecimalPlace + 1), DecimalPlace - 1) '& Format(0, String(DecimalPlace - 1, "0")) MyNumber = Trim(Left(MyNumber, DecimalPlace - 1)) End If Count = 1 Do While MyNumber "" Temp = GetHundreds(Right(MyNumber, 3)) If Temp "" Then WholeNumberText = Temp...