hi!
any idea how to convert numbers into words like for example i input the number 1 and it will display the word "one". i want to make this in a large number like morethan or around 1 million.
Anybody can help me! Thankyou in advance
hi!
any idea how to convert numbers into words like for example i input the number 1 and it will display the word "one". i want to make this in a large number like morethan or around 1 million.
Anybody can help me! Thankyou in advance
Jump to Postuse this code
''''''''''''''''''''''PASTE THIS INTO A MODULE''''''''''''''''''''''''''''''''
Public valnum, valsent As String
Private n, intpart, realpart, numchar, intword, realword, spltval, spltword As String
Private flag As BooleanPublic Sub WordConvert()
n = ""
intpart = ""
realpart = ""
numchar = ""
intword = ""
realword = …
use this code
''''''''''''''''''''''PASTE THIS INTO A MODULE''''''''''''''''''''''''''''''''
Public valnum, valsent As String
Private n, intpart, realpart, numchar, intword, realword, spltval, spltword As String
Private flag As Boolean
Public Sub WordConvert()
n = ""
intpart = ""
realpart = ""
numchar = ""
intword = ""
realword = ""
spltval = ""
spltword = ""
valsent = ""
If valnum = "." Then valnum = "0.00"
If valnum = "" Then Exit Sub
intpart = Format(Int(valnum), "000000000")
realpart = Right(valnum, 2)
spltval = realpart
Call ValFind
If spltword <> "" Then realword = spltword
spltval = Mid(intpart, 1, 2)
Call ValFind
If spltword <> "" Then intword = spltword + "Crore "
spltval = Mid(intpart, 3, 2)
Call ValFind
If spltword <> "" Then intword = intword + spltword + "Lakh "
spltval = Mid(intpart, 5, 2)
Call ValFind
If spltword <> "" Then intword = intword + spltword + "Thousand "
n = Mid(intpart, 7, 1)
Call ONES
If numchar <> "" Then intword = intword + numchar + "Hundred "
spltval = Mid(intpart, 8, 2)
If intword <> "" And Val(spltval) > 0 And realword = "" Then intword = intword + "AND "
Call ValFind
If spltword <> "" Then intword = intword + spltword
If intword <> "" And realword <> "" Then valsent = intword + " AND Paise " + realword + "Only"
If intword <> "" And realword = "" Then valsent = intword + "Only"
If intword = "" And realword <> "" Then valsent = "Paise: " + realword + "Only"
End Sub
Private Sub ValFind()
n = ""
spltword = ""
If Val(spltval) = 0 Then Exit Sub
n = Left(spltval, 1)
Call TENS
spltword = numchar
If flag = False Then n = Right(spltval, 1): Call ONES: spltword = spltword + numchar
End Sub
Private Sub ONES()
numchar = ""
If n = 0 Then numchar = ""
If n = 1 Then numchar = "One "
If n = 2 Then numchar = "Two "
If n = 3 Then numchar = "Three "
If n = 4 Then numchar = "Four "
If n = 5 Then numchar = "Five "
If n = 6 Then numchar = "Six "
If n = 7 Then numchar = "Seven "
If n = 8 Then numchar = "Eight "
If n = 9 Then numchar = "Nine "
End Sub
Private Sub TENS()
numchar = ""
If n = 1 Then n = Right(spltval, 1): Call TEENS: flag = True: Exit Sub Else flag = False
If n = 0 Then numchar = ""
If n = 2 Then numchar = "Twenty "
If n = 3 Then numchar = "Thirty "
If n = 4 Then numchar = "Fourty "
If n = 5 Then numchar = "Fifty "
If n = 6 Then numchar = "Sixty "
If n = 7 Then numchar = "Seventy "
If n = 8 Then numchar = "Eighty "
If n = 9 Then numchar = "Ninety "
End Sub
Private Sub TEENS()
numchar = ""
If n = 0 Then numchar = "Ten "
If n = 1 Then numchar = "Eleven "
If n = 2 Then numchar = "Twelve "
If n = 3 Then numchar = "Thirteen "
If n = 4 Then numchar = "Fourteen "
If n = 5 Then numchar = "Fifteen "
If n = 6 Then numchar = "Sixteen "
If n = 7 Then numchar = "Seventeen "
If n = 8 Then numchar = "Eighteen "
If n = 9 Then numchar = "Nineten "
End Sub
'''''''''''''''''''''''''''''FUNCTION USAGE''''''''''''''''''''''''''''''''
Dim c as double
c=1265
valnum = Format(c, ".00")
Call WordConvert
msgbox valsent
will return 'One Thousand Two Hundred AND Sixty Five Only'
can u cr8 me program that words converted to numbers.(1-50) using switch. pls help me.
Hi locsin,
Such questions were answered many times. I hope you can go through previous solved threads.
Thanks
Raising the dead brrrr! I thought necromancing was only in movies and games....
Soulcandra, please start your own thread and we will gladly help. Also show us what you have done as far as coding is concerned so we can help you from there.
We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.