+ Reply to Thread
Results 1 to 4 of 4

Function works but I get a run time error 13.

  1. #1
    Forum Contributor
    Join Date
    02-16-2012
    Location
    London, England
    MS-Off Ver
    Excel mac 2011
    Posts
    238

    Function works but I get a run time error 13.

    Hi,

    This is a function to add the ascii values of a string to give a single value. Initially I wrote this as a Sub routine and it worked fine, but when making it into a function, I get this error. From a little research it appears that you can not use a string as an arguement for a function call, yet that defeats the object of this particular function.

    The intention of this function is that it works on a name in a given cell and the value (an integar) that is produced is then displayed in another cell, or if using it as a formula, the cell the formula is in.

    I simple wrote the work "Hello" in cell A1 the ascii values of these added ignoring any spaces give 500 which is correct.

    Please Login or Register  to view this content.
    Any help would be appreciated

    Rob

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Function works but I get a run time error 13.

    Rob

    Your function doesn't take any arguments, it also doesn't return anything.

    Here's a function that can be used to add the ASCII values of a string.
    Please Login or Register  to view this content.
    You would call it using a formula in a cell like this.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    02-16-2012
    Location
    London, England
    MS-Off Ver
    Excel mac 2011
    Posts
    238

    Re: Function works but I get a run time error 13.

    Thank you Norie, that is excellent, I actually came up with this after discovering the debug command, it's almost identical, but it is good to get verification.
    Please Login or Register  to view this content.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Function works but I get a run time error 13.

    The function still isn't actually returning anything.

    You could change it to this and the value the function returns will be put in D1.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] error handling (works first time but not the second)
    By apenca in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-26-2014, 12:04 PM
  2. Formula works but Run Time Error 13 Type Mismatch in VBA
    By uberathlete in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-29-2013, 10:05 PM
  3. [SOLVED] run time error 91 - but code works in another spreadsheet ?
    By pmasrich in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2013, 07:32 AM
  4. 1st Sub works the 2nd Sub a Run Time Error
    By Random_dave in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-11-2012, 04:35 AM
  5. Error on second run - works the first time
    By projecttoday in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2011, 03:21 AM

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