+ Reply to Thread
Results 1 to 3 of 3

User defined function returns #Value when argument is Defined Row Name

  1. #1
    Registered User
    Join Date
    04-02-2021
    Location
    Texas, USA
    MS-Off Ver
    2013
    Posts
    2

    User defined function returns #Value when argument is Defined Row Name

    Hello, newbie on the forum here, not newbie with VBA. But I am stuck with the following (simple example given):

    I am getting a #Value error with VBA user defined functions when I pass on defined row names as arguments; For example here is my User defined function:
    Option Explicit

    Function Multiply(Param1 As Integer, Param2 As Integer) As Integer
    Multiply = Param1 * Param2
    End Function

    When I define Row 1 as Param1, and Row2 as Param2 and enter =Multiply(Param1, Param2) in Row 3, it returns the #value error

    Thanks a lot for helping to solve this!

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,875

    Re: User defined function returns #Value when argument is Defined Row Name

    This forum can be strict about rules, like putting code inside of code tags (see FAQ page). You will want to edit your post to comply to avoid getting your topic locked.

    It also might be important to see exactly how you are defining these named ranges and maybe what is stored in those cells (uploading a sample file would probably be very helpful in this regard), so we can better see exactly what is being input to the function.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    04-02-2021
    Location
    Texas, USA
    MS-Off Ver
    2013
    Posts
    2

    Re: User defined function returns #Value when argument is Defined Row Name

    All right, found a solution:
    Function Multiply(Param1 As Variant, Param2 As Variant) As Integer
    Multiply = Intersect(Application.Caller.EntireColumn, Param1) * Intersect(Application.Caller.EntireColumn, Param2)
    End Function

+ 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] I want an user defined function that also returns #NUM! as result
    By thmshnf in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-22-2016, 09:09 AM
  2. Replies: 4
    Last Post: 06-28-2016, 05:38 PM
  3. Replies: 2
    Last Post: 06-26-2016, 02:17 AM
  4. Copy, paste, replace- user defined range in all the defined sheets
    By aganesan99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2014, 12:28 PM
  5. [SOLVED] User defined function takes array as argument but won't work with range
    By BuffaloFan32 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-20-2013, 12:50 PM
  6. [SOLVED] User defined function returns an error on a standard function used in it.
    By pb48 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-23-2013, 01:35 PM
  7. getting the column address of an argument to a user defined functi
    By Salman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-11-2006, 11:00 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