+ Reply to Thread
Results 1 to 3 of 3

Cell does not always recalculate

Hybrid View

  1. #1
    Registered User
    Join Date
    06-17-2008
    Location
    Christchurch, New Zealand
    Posts
    2

    Cell does not always recalculate

    Hi folks, my name is Myles and I am a s/w engineer from Christchurch in New Zealand's South Island.

    I have an issue with a cell not updating and wondered if anyone could help. I have searched the forum and not found a solution that works.

    Here is my function

    Function stops(backNumber As Integer, sheet As String)
    
        stops = Application.WorksheetFunction.Lookup(backNumber, ActiveWorkbook.Sheets(sheet).Range(myRange("A")), ActiveWorkbook.Sheets(sheet).Range(myRange("O")))
        
    End Function

    Function myRange(column As String) As String
        myRange = "$" + column + "$4:$" + column + "$203"
    End Function
    The idea is that you give it an index and a sheet name and it goes to the sheet, looks up the index in column A and returns the value from column B.

    I am using the function in Sheet1 and I have the two columns of values in Sheet2.

    When I update a value in Sheet2 column O it does not update the value that the function returns on Sheet1.
    • Selecting the Sheet1 cell and pressing Enter does not work
    • Selecting Sheet1 and pressing F9 does not work
    • None of the various macros/functions that call Calculate seem to work
    • Selecting the Sheet1 cell, pressing F2 then Enter DOES work

    I'm a bit stuck for ideas now so any help would be much appreciated.
    Last edited by VBA Noob; 06-17-2008 at 05:53 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Add
    application.volatile
    to the function(s).

    This will cause the function to recalculate whenever there is a worksheet calculation (F9, formula change etc). It adds some overhead in that it is recalculated every time, not specifically when a recalc is forced, or when an involved argument is changed.


    rylo

  3. #3
    Registered User
    Join Date
    06-17-2008
    Location
    Christchurch, New Zealand
    Posts
    2
    Brilliant! Thanks.

+ 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