Page 2 of 2 FirstFirst 12
Results 13 to 15 of 15

Thread: MS Excel (Auto convert Numeric in Words)

  1. #13
    Turk44's Avatar
    Turk44 is offline Senior Member+
    Last Online
    2nd December 2023 @ 10:56 PM
    Join Date
    29 Sep 2008
    Age
    34
    Posts
    116
    Threads
    1
    Credits
    0
    Thanked
    9

    Default

    Quote naeemgees said: View Post
    shahid bahi aap ka method mere bohat kaam ka hy mene try keya hy zabardast hy lakin mujhay 1 problum hy main saudia arabia main quantity surveyor hon or mujhay yea conversion (Rupees=Riyal & Paisas=Halala) main chayea mene aap ki file main rupees ko riyals main replace ker k dekha hy lakin shayed mere sy wo sahi nahi howa keya aap issay mere leyea change ker k dy sktay hain Plz
    ye try karain

    Code:
    Option Explicit
    'Main Function
    Function SpellNumber(ByVal MyNumber)
    Dim Riyal, Halala, Temp
    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, ".")
    ' Convert Halala and set MyNumber to dollar amount.
    If DecimalPlace > 0 Then
    Halala = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
    "00", 2))
    MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
    End If
    Count = 1
    Do While MyNumber <> ""
    Temp = GetHundreds(Right(MyNumber, 3))
    If Temp <> "" Then Riyal = Temp & Place(Count) & Riyal
    If Len(MyNumber) > 3 Then
    MyNumber = Left(MyNumber, Len(MyNumber) - 3)
    Else
    MyNumber = ""
    End If
    Count = Count + 1
    Loop
    Select Case Riyal
    Case ""
    Riyal = "No Riyal"
    Case "One"
    Riyal = "One Dollar"
    Case Else
    Riyal = Riyal & " Riyal"
    End Select
    Select Case Halala
    Case ""
    Halala = " and No Halala"
    Case "One"
    Halala = " and One Cent"
    Case Else
    Halala = " and " & Halala & " Halala"
    End Select
    SpellNumber = Riyal & Halala
    End Function
    
    ' 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
    ' Convert the tens and ones place.
    If Mid(MyNumber, 2, 1) <> "0" Then
    Result = Result & GetTens(Mid(MyNumber, 2))
    Else
    Result = Result & GetDigit(Mid(MyNumber, 3))
    End If
    GetHundreds = Result
    End Function
    
    ' Converts a number from 10 to 99 into text.
    Function GetTens(TensText)
    Dim Result As String
    Result = "" ' Null out the temporary function value.
    If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19...
    Select Case Val(TensText)
    Case 10: Result = "Ten"
    Case 11: Result = "Eleven"
    Case 12: Result = "Twelve"
    Case 13: Result = "Thirteen"
    Case 14: Result = "Fourteen"
    Case 15: Result = "Fifteen"
    Case 16: Result = "Sixteen"
    Case 17: Result = "Seventeen"
    Case 18: Result = "Eighteen"
    Case 19: Result = "Nineteen"
    Case Else
    End Select
    Else ' If value between 20-99...
    Select Case Val(Left(TensText, 1))
    Case 2: Result = "Twenty "
    Case 3: Result = "Thirty "
    Case 4: Result = "Forty "
    Case 5: Result = "Fifty "
    Case 6: Result = "Sixty "
    Case 7: Result = "Seventy "
    Case 8: Result = "Eighty "
    Case 9: Result = "Ninety "
    Case Else
    End Select
    Result = Result & GetDigit _
    (Right(TensText, 1)) ' Retrieve ones place.
    End If
    GetTens = Result
    End Function
    
    ' Converts a number from 1 to 9 into text.
    Function GetDigit(Digit)
    Select Case Val(Digit)
    Case 1: GetDigit = "One"
    Case 2: GetDigit = "Two"
    Case 3: GetDigit = "Three"
    Case 4: GetDigit = "Four"
    Case 5: GetDigit = "Five"
    Case 6: GetDigit = "Six"
    Case 7: GetDigit = "Seven"
    Case 8: GetDigit = "Eight"
    Case 9: GetDigit = "Nine"
    Case Else: GetDigit = ""
    End Select
    End Function
    Site's+Blogs Advertisements Not Allowed...ITD TEAM

  2. #14
    Join Date
    10 Aug 2009
    Location
    ***************
    Gender
    Female
    Posts
    544
    Threads
    20
    Thanked
    26

    Default

    Quote naeemgees said: View Post
    shahid bahi aap ka method mere bohat kaam ka hy mene try keya hy zabardast hy lakin mujhay 1 problum hy main saudia arabia main quantity surveyor hon or mujhay yea conversion (Rupees=Riyal & Paisas=Halala) main chayea mene aap ki file main rupees ko riyals main replace ker k dekha hy lakin shayed mere sy wo sahi nahi howa keya aap issay mere leyea change ker k dy sktay hain Plz
    Option Explicit
    'Main Function
    Function SpellNumber(ByVal MyNumber)
    Dim Riyal, Halala, Temp
    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, ".")
    ' Convert Halala and set MyNumber to Riyal amount.
    If DecimalPlace > 0 Then
    Halala = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
    "00", 2))
    MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
    End If
    Count = 1
    Do While MyNumber <> ""
    Temp = GetHundreds(Right(MyNumber, 3))
    If Temp <> "" Then Riyal = Temp & Place(Count) & Riyal
    If Len(MyNumber) > 3 Then
    MyNumber = Left(MyNumber, Len(MyNumber) - 3)
    Else
    MyNumber = ""
    End If
    Count = Count + 1
    Loop
    Select Case Riyal
    Case ""
    Riyal = "No Riyal"
    Case "One"
    Riyal = "One Riyal"
    Case Else
    Riyal = Riyal & " Riyal"
    End Select
    Select Case Halala
    Case ""
    Halala = " and No Halala"
    Case "One"
    Halala = " and One Cent"
    Case Else
    Halala = " and " & Halala & " Halala"
    End Select
    SpellNumber = Riyal & Halala
    End Function

    ' 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
    ' Convert the tens and ones place.
    If Mid(MyNumber, 2, 1) <> "0" Then
    Result = Result & GetTens(Mid(MyNumber, 2))
    Else
    Result = Result & GetDigit(Mid(MyNumber, 3))
    End If
    GetHundreds = Result
    End Function

    ' Converts a number from 10 to 99 into text.
    Function GetTens(TensText)
    Dim Result As String
    Result = "" ' Null out the temporary function value.
    If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19...
    Select Case Val(TensText)
    Case 10: Result = "Ten"
    Case 11: Result = "Eleven"
    Case 12: Result = "Twelve"
    Case 13: Result = "Thirteen"
    Case 14: Result = "Fourteen"
    Case 15: Result = "Fifteen"
    Case 16: Result = "Sixteen"
    Case 17: Result = "Seventeen"
    Case 18: Result = "Eighteen"
    Case 19: Result = "Nineteen"
    Case Else
    End Select
    Else ' If value between 20-99...
    Select Case Val(Left(TensText, 1))
    Case 2: Result = "Twenty "
    Case 3: Result = "Thirty "
    Case 4: Result = "Forty "
    Case 5: Result = "Fifty "
    Case 6: Result = "Sixty "
    Case 7: Result = "Seventy "
    Case 8: Result = "Eighty "
    Case 9: Result = "Ninety "
    Case Else
    End Select
    Result = Result & GetDigit _
    (Right(TensText, 1)) ' Retrieve ones place.
    End If
    GetTens = Result
    End Function

    ' Converts a number from 1 to 9 into text.
    Function GetDigit(Digit)
    Select Case Val(Digit)
    Case 1: GetDigit = "One"
    Case 2: GetDigit = "Two"
    Case 3: GetDigit = "Three"
    Case 4: GetDigit = "Four"
    Case 5: GetDigit = "Five"
    Case 6: GetDigit = "Six"
    Case 7: GetDigit = "Seven"
    Case 8: GetDigit = "Eight"
    Case 9: GetDigit = "Nine"
    Case Else: GetDigit = ""
    End Select
    End Function

  3. #15
    masadijaz's Avatar
    masadijaz is offline Senior Member+
    Last Online
    22nd December 2022 @ 07:36 PM
    Join Date
    15 Oct 2009
    Location
    Peshawar
    Age
    43
    Posts
    163
    Threads
    17
    Credits
    41
    Thanked
    5

    Default

    Agr hamen USD mein chahye ye koi aur currency mein chahye to phir kya karingay...

Page 2 of 2 FirstFirst 12

Similar Threads

  1. How to Convert a number to English words-Excel
    By Abu Dajana in forum Urdu Tutorials & Designing
    Replies: 24
    Last Post: 31st May 2016, 09:29 AM
  2. Excel !How To Convert RS into words
    By Adeel Anjum in forum Ask an Expert
    Replies: 5
    Last Post: 18th May 2013, 12:06 PM
  3. Solved LinK CONVERT IN Desired words. .
    By asif4796299 in forum Solved Problems (IT)
    Replies: 7
    Last Post: 13th April 2013, 06:02 PM
  4. Solved convert numbers into words in excel
    By naeemgees in forum Solved Problems (IT)
    Replies: 8
    Last Post: 27th April 2011, 07:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •