+ Reply to Thread
Results 1 to 8 of 8

Function does not work within sheet

  1. #1
    Registered User
    Join Date
    08-20-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    19

    Function does not work within sheet

    I keep getting the #VALUE! error when using this formula in my workbook and it is driving me crazy because I can't figure out why it's not working. Any thoughts?

    Please Login or Register  to view this content.
    I inserted a breakpoint and none of the variables have values. Since firstVal and lastVal depend on firstCell and lastCell parsing the range info correctly, there must be something wrong with my use of ".Cells(x,y)", but it doesn't seem like I am using it wrong. It has to be something stupid that I'm overlooking.

    P.S. I tried simplifying it like below, but still no luck:
    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    08-19-2012
    Location
    Cambodia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Function does not work within sheet

    In excel, outputting somethings to cells in function should not be performed, otherwise you'll get errors.
    Learn Excel along with practical examples:http://www.worldbestlearningcenter.c...se-example.htm

  3. #3
    Registered User
    Join Date
    08-20-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Function does not work within sheet

    @darayuk, I'm not sure I follow. What do you mean by the following?

    outputting somethings to cells in function should not be performed
    According to my code I am not trying to output anything. I am merely trying to read what is there and parse data from a range.

  4. #4
    Registered User
    Join Date
    08-20-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Function does not work within sheet

    Here is a sample worksheet with the error for reference. Any help would be greatly appreciated!!

    CAGR.xlsm

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Function does not work within sheet

    Please Login or Register  to view this content.
    You are assigning (Copying) the value of cells(1,), or Range("A1") in to firstCell varaible, but I do not see any value on cells(1,1). The same goes for the other varaibles.

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

    Re: Function does not work within sheet

    Since firstVal and lastVal depend on firstCell and lastCell parsing the range info correctly, there must be something wrong with my use of ".Cells(x,y)",
    Or there is something wrong with the way rng is being passed to the function. Is the reference in the function call correct? When in break mode, does rng have any information in it?

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Function does not work within sheet

    you need to use Set with objects
    Please Login or Register  to view this content.
    but the range objects are pointless here
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  8. #8
    Registered User
    Join Date
    08-20-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Function does not work within sheet

    Thanks! You're right, they are unnecessary anyway. Take care!

+ 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