View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Is there a formular or format to change 1 to one

Hi Kevin

To convert whole numbers, or integer values, try this minor adaptation of
the main SpellNumber function:

'============
Function SpellNumber(ByVal MyNumber)
Dim sStr As String
Dim Temp As Variant
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, ".")
' Remove decimals
If DecimalPlace 0 Then
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If

Count = 1
Do While MyNumber < ""
Temp = GetHundreds(Right(MyNumber, 3))
If Temp < "" Then sStr = Temp & Place(Count) & sStr
If Len(MyNumber) 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop

SpellNumber = sStr

End Function
'<<============



---
Regards,
Norman


"Kevin" wrote in message
...
Thanks for the tip. Is there one that does the numbers without the dollars
and cents.
Kevin

"Norman Jones" wrote:

Hi Kevin,

See:

http://www.xldynamic.com/source/xld.xlFAQ0004.html


---
Regards,
Norman



"Kevin" wrote in message
...
Is there a formular or format to change a number "1" into the word
"one".