Convert Numbers to Text

  • Thread starter Thread starter will07
  • Start date Start date
W

will07

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
 
i'm not sure what you're using, but look for the word "Hundred" and change
it to "Hundred and "
 
Checks are normally written without the 'and'.

Gary Keramidas said:
i'm not sure what you're using, but look for the word "Hundred" and change
it to "Hundred and "
--


Gary Keramidas
Excel 2003




.
 
Thanks for the reply, you are right, most documents do not require the and,
because this is being used for tender letters, managment require the word
"and"

Thanks for the help.
 
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.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
 
this should work
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "

to this
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred and "
 
Hi Gary, Changed the code as you said, it worked 1st time, I am so grateful
for your time and help to get me over this hurdle. Thanks again

Will
 
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
 
Back
Top