+ Reply to Thread
Results 1 to 8 of 8

NEED HELP FOR SPELL NUMBER FUNCTION (its not working for all excel sheet)

  1. #1
    Registered User
    Join Date
    04-30-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    Post NEED HELP FOR SPELL NUMBER FUNCTION (its not working for all excel sheet)

    hello
    i have code to covert number to word but problem is its working only for current excel sheet till the time i am using when i closed excel and reopen g its doesn't work. how can i make it work for every excel...

    STEPS i m using is for SPELLNUMBER...
    1. COPY CODE THEN EXCEL (ALT+F11) THEN INSERT MODULE PAST FORMULA AFTER THAT SAVE AS (macro enable worksheet.xlsm) in C Drive.

    i m using excel 2007.

    Thanks & Regards
    Saquib Ansari
    [email protected]
    Mumbai –India

  2. #2
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: NEED HELP FOR SPELL NUMBER FUNCTION (its not working for all excel sheet)

    Sorry.......Please upload the workbook for better clarification.....
    Last edited by LokeshKumar; 05-05-2015 at 01:15 AM.
    Lokesh Kumar
    Stay Hungry.. Stay Foolish..
    _________________________________________________________
    Please Click STAR to Add Reputation if my/someone's answer helped!

  3. #3
    Forum Contributor
    Join Date
    03-11-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    379

    Re: NEED HELP FOR SPELL NUMBER FUNCTION (its not working for all excel sheet)

    Hi Saquib,

    It seems there can be two scenarios:

    1) You have a code which you need to save in Worksheet Module (if it starts with
    Please Login or Register  to view this content.
    2) You have code which you need to save in standard module. (if it starts with some thing like
    Please Login or Register  to view this content.
    Regards,
    AM

  4. #4
    Registered User
    Join Date
    04-30-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    Re: NEED HELP FOR SPELL NUMBER FUNCTION (its not working for all excel sheet)

    Lokesh,

    below mentioned is code i m using, if u feel to make any change pls let me know or do it from ur end and send me edited code.

    Function SpellNumber(amt As Variant) As Variant
    Dim FIGURE As Variant
    Dim LENFIG As Integer
    Dim i As Integer
    Dim WORDs(19) As String
    Dim tens(9) As String
    WORDs(1) = "One"
    WORDs(2) = "Two"
    WORDs(3) = "Three"
    WORDs(4) = "Four"
    WORDs(5) = "Five"
    WORDs(6) = "Six"
    WORDs(7) = "Seven"
    WORDs(8) = "Eight"
    WORDs(9) = "Nine"
    WORDs(10) = "Ten"
    WORDs(11) = "Eleven"
    WORDs(12) = "Twelve"
    WORDs(13) = "Thirteen"
    WORDs(14) = "Fourteen"
    WORDs(15) = "Fifteen"
    WORDs(16) = "Sixteen"
    WORDs(17) = "Seventeen"
    WORDs(18) = "Eighteen"
    WORDs(19) = "Nineteen"
    tens(2) = "Twenty"
    tens(3) = "Thirty"
    tens(4) = "Fourty"
    tens(5) = "Fifty"
    tens(6) = "Sixty"
    tens(7) = "Seventy"
    tens(8) = "Eighty"
    tens(9) = "Ninety"
    FIGURE = amt
    FIGURE = Format(FIGURE, "FIXED")
    FIGLEN = Len(FIGURE)
    If FIGLEN < 12 Then
    FIGURE = Space(12 - FIGLEN) & FIGURE
    End If
    If Val(Left(FIGURE, 9)) > 1 Then
    SpellNumber = "Rupees "
    ElseIf Val(Left(FIGURE, 9)) = 1 Then
    SpellNumber = "Rupee "
    End If
    For i = 1 To 3
    If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & WORDs(Val(Left(FIGURE, 2)))
    ElseIf Val(Left(FIGURE, 2)) > 19 Then
    SpellNumber = SpellNumber & tens(Val(Left(FIGURE, 1)))
    SpellNumber = SpellNumber & WORDs(Val(Right(Left(FIGURE, 2), 1)))
    End If
    If i = 1 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & " Crore "
    ElseIf i = 2 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & " Lakh "
    ElseIf i = 3 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & " Thousand "
    End If
    FIGURE = Mid(FIGURE, 3)
    Next i
    If Val(Left(FIGURE, 1)) > 0 Then
    SpellNumber = SpellNumber & WORDs(Val(Left(FIGURE, 1))) + " Hundred "
    End If
    FIGURE = Mid(FIGURE, 2)
    If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & WORDs(Val(Left(FIGURE, 2)))
    ElseIf Val(Left(FIGURE, 2)) > 19 Then
    SpellNumber = SpellNumber & tens(Val(Left(FIGURE, 1)))
    SpellNumber = SpellNumber & WORDs(Val(Right(Left(FIGURE, 2), 1)))
    End If
    FIGURE = Mid(FIGURE, 4)
    If Val(FIGURE) > 0 Then
    SpellNumber = SpellNumber & " Paise "
    If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
    SpellNumber = SpellNumber & WORDs(Val(Left(FIGURE, 2)))
    ElseIf Val(Left(FIGURE, 2)) > 19 Then
    SpellNumber = SpellNumber & tens(Val(Left(FIGURE, 1)))
    SpellNumber = SpellNumber & WORDs(Val(Right(Left(FIGURE, 2), 1)))
    End If
    End If
    FIGURE = amt
    FIGURE = Format(FIGURE, "FIXED")
    If Val(FIGURE) > 0 Then
    SpellNumber = SpellNumber & " Only "
    End If
    End Function

  5. #5
    Registered User
    Join Date
    04-30-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    Re: NEED HELP FOR SPELL NUMBER FUNCTION (its not working for all excel sheet)

    lokes these r two file
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-30-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    8

    Re: NEED HELP FOR SPELL NUMBER FUNCTION (its not working for all excel sheet)

    Ashish,

    please find attached codes for spell number and excel sheet where i save the codes.
    Attached Files Attached Files

  7. #7
    Forum Contributor LokeshKumar's Avatar
    Join Date
    03-31-2015
    Location
    India
    MS-Off Ver
    All, mostly 2010 now..
    Posts
    471

    Re: NEED HELP FOR SPELL NUMBER FUNCTION (its not working for all excel sheet)

    Hi,
    Your code is working fine.....
    I guess you want you can use this function to any file.....you have to declare it as public and you need to save a personal macro book.....which always have your code and always remain hide.......
    read from this.....https://support.office.com/en-nz/art...0-6e4c3f5ee566

  8. #8
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Colombo, Sri Lanka
    MS-Off Ver
    2010
    Posts
    129

    Re: NEED HELP FOR SPELL NUMBER FUNCTION (its not working for all excel sheet)

    Hi Saquib,

    appreciate if you can assist me with your own code on SPELLNUMBER.

    1. for example, convert 345,987.78 to appear as "(USD: Three hundred & Forty Five thousand Nine hundred & Eighty Seven and Cents Seventy Eight only)". observed in your code that two words are pasted together in between.
    2. as above but without the brackets and "USD"........ something like "Three ........ Eight only"

    many thanks

    Rizvi

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Similar Threads

  1. how to spell out number using function in Excel
    By Beans in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  2. [SOLVED] how to spell out number using function in Excel
    By JE McGimpsey in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-06-2005, 09:05 AM
  3. how to spell out number using function in Excel
    By Beans in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  4. [SOLVED] how to spell out number using function in Excel
    By Beans in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  5. [SOLVED] how to spell out number using function in Excel
    By Beans in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1