Convert Numbers to Text

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
 
G

Gary Keramidas

i'm not sure what you're using, but look for the word "Hundred" and change
it to "Hundred and "
 
T

TexPop

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




.
 
W

will07

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.
 
L

L. Howard Kittle

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
 
G

Gary Keramidas

this should work
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "

to this
Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred and "
 
W

will07

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
 
W

will07

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top