+ Reply to Thread
Results 1 to 7 of 7

#value! error in custom functions

  1. #1
    Registered User
    Join Date
    09-16-2010
    Location
    spain
    MS-Off Ver
    Excel 365
    Posts
    14

    #value! error in custom functions

    I have created a excelsheet with lots of custom functions.

    Everything worked perfect but suddenly all the cells with custom functions display #value!.

    When I go to the cells and press enter (maintaining the custom formula), the result is again displayed correctly.

    How can I avoid this and what is the reason for this to happen?

    Thanks!

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: #value! error in custom functions

    Did you open the sheet with macros disabled, maybe?

  3. #3
    Registered User
    Join Date
    09-16-2010
    Location
    spain
    MS-Off Ver
    Excel 365
    Posts
    14

    Re: #value! error in custom functions

    No, macros are enabled. Anyways, if I go to the cell and press enter, the #value message dissappears and the result is displayed. But I don't want to do this manually for all the cells and it's a sheet for customers, so I don't want this to happen again in the future !!

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: #value! error in custom functions

    What's the code for the functions? (does it refer to Activecell or activesheet for example? that's a big no-no.)

    If you had macros disabled, you should get a #NAME error, rather than #VALUE.
    Remember what the dormouse said
    Feed your head

  5. #5
    Registered User
    Join Date
    09-16-2010
    Location
    spain
    MS-Off Ver
    Excel 365
    Posts
    14

    Re: #value! error in custom functions

    Phhuuuuu,

    there are plenty of formulas, but basically they just do calculations picking some values from other worksheets, but I don't use Activecell / Activesheet.

  6. #6
    Registered User
    Join Date
    09-16-2010
    Location
    spain
    MS-Off Ver
    Excel 365
    Posts
    14

    Re: #value! error in custom functions

    example:

    Function g(num)
    g = Worksheets("Materiales").Cells(14 + num, 3).Value
    End Function

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: #value! error in custom functions

    It is never a good idea to hardcode worksheet names in UDFs. You would also need to make that formula volatile for it to react to changes on the other sheet.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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