+ Reply to Thread
Results 1 to 4 of 4

#NAME? error for user-defined vba function

  1. #1
    Registered User
    Join Date
    09-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    #NAME? error for user-defined vba function

    I wrote the following function in a standard VBA Module (not a Class Module):

    Please Login or Register  to view this content.
    After saving and returning to a worksheet, any call to the function yields a #NAME? error. I also tried to save, exit Excel, and reopen, but still no luck. Any advice would be appreciated. Thank you.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: #NAME? error for user-defined vba function

    You saved as an xlsm file?

    Macro security is set to Medium?

    You enabled macros when the workbook opened?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    09-30-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: #NAME? error for user-defined vba function

    I have the function saved in a Module in my PERSONAL.XLSB file so I can use it whenever I open Excel. I know that if I copy the code into a Module for a given macro-enabled worksheet that I'll be able to call the function on that specific worksheet, but I want to have access to this function at all times...but yes, macro security is set to medium and the workbook I want to run it in is macro-enabled (.xlsm).

    Thanks for the help.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: #NAME? error for user-defined vba function

    Either preface the call

    =personal.xlsb!mymacro(...)

    ... or in the VBE set a reference in the workbook to Personal.xlsb.

    If you choose the latter, then name the project in Personal (mine is projPersonal), and in the VBE, Tools > References, find it, tick it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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