+ Reply to Thread
Results 1 to 3 of 3

#VALUE! error from UDF

  1. #1
    Registered User
    Join Date
    07-10-2013
    Location
    Portland, Oregon
    MS-Off Ver
    Excel 2010
    Posts
    7

    #VALUE! error from UDF

    I have this user defined function that takes two inputs (temp and relative humidity) and gives one output (enthalpy). I have created the code in a macro-enabled workbook, checked all the functions within the spreadsheet, and then saved as an add-in. When I open the add-in in another workbook, all the other UDFs work except one. This function returns a #VALUE! error, although the correct data type is selected. When I try it in the original workbook, it starts with the error, I open VBA and save the code and ppof, it works without me changing anything. Below is the code and any help is always greatly appreciated.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 08-01-2013 at 03:11 PM. Reason: Added CODE tags, as per Forum Rules. Take a moment to read the Forum Rules in the menu bar above. Thanks.

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: #VALUE! error from UDF

    this does not look like a udf. it looks more lika a macro
    I am giging you a trivial example of udf
    udf will be dealing with variable
    using UDF you can gets the result either as a macro or formula in worksheet.
    see attached file "phillip 130803"
    the UDF is in the module

    in spreadsheet if you type the formla as in c10 you will get 15

    if you run the macro test from the module then also msgbox will give 15

    now you can understand what is a UDF and how to use it. now you can rewrite UDF and macro or formula

    if there is problem or doubt post back to the newsgroup
    Attached Files Attached Files
    I am not an expert. better solutions may be available
    [email protected]

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: #VALUE! error from UDF

    @Venkat - UDF simply means User Defined Function.

    Philip's code is a Function, not a Sub, so by definition it is a UDF.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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. Receiving following error “Complie error : syntax error” Help
    By masond3 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2012, 10:19 AM
  2. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  3. [SOLVED] Macro error - Run time error 1004 (App defined/Object Defined error)
    By jlax34 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-06-2012, 03:02 PM
  4. Error 75 File/Path access error, sometimes Error 1004
    By smokebreak in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-16-2011, 02:35 PM
  5. [SOLVED] Error Handling - On Error GoTo doesn't trap error successfully
    By David in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2006, 02:10 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