+ Reply to Thread
Results 1 to 3 of 3

UDF argument problem

  1. #1

    UDF argument problem

    I'm trying to do the following:

    When you enter the following function:
    =SDSUM(A1:B3,$B$1,B1>B2)

    I want the third argument in:
    Function SDSUM(database, col, criteria)

    named criteria, not to return whether B1>B2 (True of False), but (just)
    the string. However, I don't want to put quotation marks around it
    because I want the user to click around in the worksheet to make
    selections.

    Any way to do this?

    Thanks for any ideas.

    Hessel


  2. #2
    Tom Ogilvy
    Guest

    Re: UDF argument problem

    Public Function Test(sStr As String)
    Dim sCrit As String
    Set rng = Application.Caller
    sCrit = rng.Formula
    sCrit = Mid(sCrit, 7)
    Test = Left(sCrit, Len(sCrit) - 1)
    End Function

    =Test(B1>B2)

    Returns B1>B2
    --
    Regards,
    Tom Ogilvy

    <[email protected]> wrote in message
    news:[email protected]...
    > I'm trying to do the following:
    >
    > When you enter the following function:
    > =SDSUM(A1:B3,$B$1,B1>B2)
    >
    > I want the third argument in:
    > Function SDSUM(database, col, criteria)
    >
    > named criteria, not to return whether B1>B2 (True of False), but (just)
    > the string. However, I don't want to put quotation marks around it
    > because I want the user to click around in the worksheet to make
    > selections.
    >
    > Any way to do this?
    >
    > Thanks for any ideas.
    >
    > Hessel
    >




  3. #3

    Re: UDF argument problem

    I would never have thought of using application.caller for this, but it
    works!


    Thanks a lot!


+ 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