+ Reply to Thread
Results 1 to 4 of 4

Value! Error in UDF

  1. #1
    Registered User
    Join Date
    10-08-2015
    Location
    Pennsylvania, United States
    MS-Off Ver
    Professional Plus 2013
    Posts
    2

    Value! Error in UDF

    I'm new to VBA and am having trouble with this function. My goal is to find the difference between the sums of the cells in two ranges (sourceDR and sourceCR) which match a value (given in match) in a criterion range (subset).

    Please Login or Register  to view this content.
    The function is returning #Value! when I attempt to evaluate it in a worksheet. For example, if the data ranges are b1:b4 and c1:c4, the criterion range is a1:a4, and the value to be matched is in a6, I enter
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    into b6 and get #Value!. If I omit the sourceCR argument (c1:c4), the function correctly returns the sum of b1:b4 for which the criterion in a1:a4 matches a6.

    Thanks for your help.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,487

    Re: Value! Error in UDF

    Works for me. Suspect it's your data.

    Please Login or Register  to view this content.

    You probably need to post a sample workbook that demonstrates the problem.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    10-08-2015
    Location
    Pennsylvania, United States
    MS-Off Ver
    Professional Plus 2013
    Posts
    2

    Re: Value! Error in UDF

    Yes, you're right. I copied all of my data into a new workbook, and now the function runs properly. Thanks!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,487

    Re: Value! Error in UDF

    You're welcome. Thanks for the rep.

+ 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. VBA ERROR: run time error 1004: Application-defined or Object-defined error in excel 2013
    By AnanthKrishna in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2015, 06:16 AM
  2. [SOLVED] Run-tim error -2147467259(80004005): Automation error Unspecidied error
    By mattress58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-25-2014, 12:12 PM
  3. Excel macro (compile error. syntax error.) error
    By salar_younis in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-06-2014, 06:11 AM
  4. 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
  5. 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
  6. 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
  7. [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