View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
will07 will07 is offline
external usenet poster
 
Posts: 28
Default Convert Numbers to Text

Hi, I changed the code as you suggested and it worked 1st time. Thank you
for your advice, it got me over a great hurdle.

Thanks Again

"L. Howard Kittle" wrote:

Maybe here is where you need to enter "AND".

Untested.
' Converts a number from 100-999 into text
Function GetHundreds(ByVal MyNumber)
Dim Result As String
If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)
' Convert the hundreds place.
If Mid(MyNumber, 1, 1) < "0" Then

Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
End If
If Mid(MyNumber, 1, 1) < "0" Then
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred and "
End If

HTH
Regards,
Howard

"will07" wrote in message
...
Hi, I use the code available from the Microsoft Web site that converts
numbers to text and it works very well however, I have had requests to add
the word "and" in between the thousands and hundreds : example

Instead of "One Thousand Two Hundred Fifty Nine Dollars and Ten Cents" as
it
now shows

I Need "One Thousand Two Hundred and Fifty Nine Dollars and Ten Cents

With my limited knowledge I realise that you have to add the word "and" to
somewhere in the existing code, just not sure where ??

Thanks



.