Skip to main content

Posts

Showing posts from February, 2009

Number to Text in Excel in currency format that spells out the decimal portion

follow the instructions on my previous post . replace the code with the following: 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 = GetTens(Round(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2), 2)) MyNumber = Trim(Left(MyNumber, DecimalPlace - 1)) End If Count = 1 Do While MyNumber <> "" Temp = GetHundreds(Right(MyNumber, 3)) If Temp <> "" Then WholeNumberText = Temp & Place(Count) & WholeNumbe