+ Reply to Thread
Results 1 to 3 of 3

Excel Function Output not updating

  1. #1
    Registered User
    Join Date
    03-06-2008
    Posts
    1

    Excel Function Output not updating

    Hi All!

    Apologies to make my first post a question but I am more than planning to make up for that....

    I have a problem in a small VBA function, the purpose of which is as follows:

    Say you have an Excel wookbook with 4 sheets, named UK-1, GR-2, UK-3, and CONSOLIDATE. The function will only be used in the CONSOLIDATE sheet. Basically the aim is have the value of a cell in the CONSOLIDATE sheet to be the conditional sum of the cells in the same location on the other sheets. Best illustrated by example:

    Say the cell $A$3 in UK-1 is 4, $A$3 in GR-2 is 100, and cell $A$3 in worksheet UK-3 is 2000. If on the CONSOLIDATE sheet in cell A3 you use the function =CONSOL("UK"), then the value of A3 on the CONSOLIDATE sheet will sum up all the values of $A$3 on the other sheets, as long as the first two letters in the name of the worksheet are "UK". So if you used =CONSOL("UK") in this example the value of $A$3 on the CONSOLIDATE sheet would be 4 + 2000 = 2004. If you changed the function to =CONSOL("GR"), the value returned in cell $A$3 in the CONSOLIDATE sheet should be 100 (note that you avoid circular references by not naming the sheet where the function is written starting with "UK" or "GR").

    Code is as follows:

    Please Login or Register  to view this content.

    This formula appears to work except for two apparant issues. Firstly (following on from example above), if you change the value of cell $A$3 on one of the "feeder" sheets, and click back to the CONSOLIDATE sheet, then the CONSOLIDATE sheet does not reflect the change made unless you press F2, then RETURN/ENTER on the cell. Is there any way to get the function to automatically update if you change one of the feeder cells?

    Secondly, you should be able to use this exact same formula in a number of cells on the CONSOLIDATE sheet, all off which should return different values (as long as the conditional sums are not equivalent). For example if you write =CONSOL("UK") in cell $A$3 and drag that across to cell $A$4 (so that cell $A$4 is also =CONSOL("UK") ), the output in cell $A$4 should be different to the output in $A$3 as the function references different cells on the "feeder" sheets. However if you make this drag, then it just fills in the same figures on all cells. Now again, if you press F2, then ENTER on a particular cell, it updates to what you would expect would be the correct output based on the cell location, but it doesn't make this update automatically. Is there any way to get around this?

    I am not sure if the general format of my formula is just generally unstable and poorly coded hence I am having difficulties or there is a reason the automatic update is not occurring. But any feedback would be appreciated .

    Many Thanks,
    Aj.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi , Try adding the following at the start of your code.
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Registered User
    Join Date
    12-03-2008
    Location
    India
    Posts
    4
    application.volatile doesn't work

+ 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