+ Reply to Thread
Results 1 to 6 of 6

Why doesn't my custom function run in a cell

  1. #1
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    201

    Why doesn't my custom function run in a cell

    I created a custom function to retrieve an account balance. It is declared as Public Function.

    I now need to enter this function in a cell on another worksheet where the balance of the account must be displayed. So I enter
    Please Login or Register  to view this content.
    into the cell where I want the balance displayed. When I first enter the formula in the cell the balance is displayed correctly. When I do other transactions and then do a Application.Calculate the formula is not recalculated. Pressing F9 also doesn't recalculate the new balance.

    What am I missing or doing wrong? Why is the formula not recalculated?

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,274

    Re: Why doesn't my custom function run in a cell

    What are cAccNumber and dDate?
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: Why doesn't my custom function run in a cell

    In the cell it would be references to other cells. One with the account number and one with the date e.g. =Get_Account_Balance(B3, C3) where B3 has a text string account number e.g. 1001000100-CASH and C3 has a date in it e.g. 17-Nov-14.

    What Get_Account_Balance will then do is find the 1001000100-CASH account in the Accounting worksheet and then find the last entry on or before 17-Nov-14 and return the account balance in that account on that date.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,274

    Re: Why doesn't my custom function run in a cell

    Unless the direct inputs to the function change, the formula won't recalculate. It seems you have other references to ranges in the code which isn't good practice but if you need the formula to update regardless you need to make the function volatile.

  5. #5
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: Why doesn't my custom function run in a cell

    Thanks romperstomper. That solved my problem.

  6. #6
    Forum Contributor
    Join Date
    12-06-2012
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    201

    Re: Why doesn't my custom function run in a cell

    Wanted to add to your reputation but it won't let me. Sorry.

+ 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. Custom Worksheet Function doesn't update
    By jeffersii in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-27-2009, 08:46 AM
  2. Custom VBA function doesn't work
    By MCCCLXXXV in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2008, 04:54 PM
  3. Use a function in a chart range so it doesn't include a cell if blank?
    By hokeyplyr48 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-03-2008, 12:32 PM
  4. [SOLVED] A correct IF function doesn't show the function's result in cell
    By Michael in forum Excel General
    Replies: 1
    Last Post: 04-10-2006, 04:15 AM
  5. Custom Function: Detecting the cell the function is used in
    By g-boy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2005, 02:05 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