+ Reply to Thread
Results 1 to 4 of 4

passing variable?

  1. #1
    Registered User
    Join Date
    07-06-2008
    Location
    romania
    Posts
    1

    passing variable?

    Hello!
    I want to make a udf function in VBA to count something from a range of cells. This is the code:
    Please Login or Register  to view this content.
    I get the error "#VALUE!" when I enter the formula (like this: =NrOreProgram(B2:N2) ) in a cell.Can you help me please? Thank you for your time!
    Last edited by leroiv; 07-06-2008 at 04:32 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    What's the purpose of the Function, it loks like you are trying to enter a countif function into a cell.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Your formula has an extra bracket at the end, but it will still error.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Funtions return values, they don't write to cells.

    With this function,
    Please Login or Register  to view this content.
    putting = NrOreProgramNormal(B2:N2) in a cell will return the desired value.

    It's the equivilant (even though slower) to putting COUNTIF(B2:N2,"P") in the cell.

    What are you trying to do? It may be that a function is not the way to acheive your goal.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ 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