+ Reply to Thread
Results 1 to 4 of 4

Recalculation based on changing cell

  1. #1
    Forum Contributor
    Join Date
    03-11-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2016 (among others!)
    Posts
    331

    Recalculation based on changing cell

    Following on from earlier posts I have an odd one.

    I have a function that basically looks up a code in a hard coded array. The argument that passes to the function can be changed via another cell. So the custom function is called Bob and takes an argument rate so it could be =Bob("SRB"). Further development means that that now becomes =Bob(country & "SRB"). Country is a named single cell. This cell will link via an if statement to a dropdown box for the user. So the user selects from a dropdown of which country and the cell country changes to match. Weirldy when this happens Bob doesn't update unless I go in and recalc.

    So I figured the idea was to write code in Worksheet_Change, but I always want it to look at the cell country - even though the input from the user could be almost anywhere. My problem is, while I could get the recalc to trigger on the user changing the drop down, that will be a PITA to do in 40 books. Hence alwyas having one cell. But I cannot get the event to trigger on a cell that changes, but which the user hasn't actually changed by entering in the cell. Am I missing something here or is this how it is meant to (not) work?

  2. #2
    Forum Contributor
    Join Date
    03-11-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2016 (among others!)
    Posts
    331

    Re: Recalculation based on changing cell

    Just stumlbed across worksheet_calculate which seems to work fine except for the fact I actually need to go into the cell still to force it to recalc (even F9 won't work). Bit confused why it doesn't update as expected.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,462

    Re: Recalculation based on changing cell

    I am not following exactly what you are doing. I use a lot of UDF's and I don't have trouble with those UDF's updating when their arguments change. Usually, when this situation occurs, it is because the UDF is receiving data from the spreadsheet other than through the argument list. Can you share a typical worksheet + UDF code that illustrates what you are seeing?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Forum Contributor
    Join Date
    03-11-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2016 (among others!)
    Posts
    331

    Re: Recalculation based on changing cell

    As I was working through it, and then looking at what you said I think my "clever" idea to claim a variable directly from the sheet rather than passing it via the formula is the problem. I guess I was just looking to shortcut the problem giving the number of books I need to update. Looks like it is back to the drawing board. Thanks for the help though.

+ 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] Changing fill color of shapes based on changing cell value
    By Stefan1983 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2012, 10:33 AM
  2. Replies: 2
    Last Post: 01-27-2012, 09:40 PM
  3. Replies: 0
    Last Post: 09-29-2010, 04:50 PM
  4. Changing cell fill colour based on date in cell - Multiple rows
    By ExcelNewb2010 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2010, 07:30 AM
  5. changing cell color based on changing values
    By tvonbehren in forum Excel General
    Replies: 2
    Last Post: 09-16-2009, 12:33 PM
  6. Find Last Cell In range, and changing another Cell based on offset text
    By radar_jynx in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-05-2009, 04:52 AM
  7. Recalculation after changing non-dependent cells
    By aksuperfly13 in forum Excel General
    Replies: 0
    Last Post: 08-28-2008, 12:23 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