User defined function wont update

Joe Joel 25 Reputation points
2023-03-09T15:25:15.0033333+00:00

I've created a user defined function in excel to automatically pull data from 2 tables and multiply them and the data it pulls is dependent on and referenced agaist the row and column titles of the cell the formula is applied to.

When I apply this to a table as a whole it will not automatically calculate or update. The only way to get it to update is to efectively refresh each cell indevidually.

Is there a way that I can make this formula dynamic and automatically update without any input? or is there a way I can write another macro to automatically update the table?

Code is below:

User's image

THis is the table after refreshing the full page:

User's image

This is after going into a cell, clicking on the function and pressing enter to recalculate:

User's image

Any help would be apreciated.

Thanks

Microsoft 365 and Office Development Other
Microsoft 365 and Office Excel For business Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 122.5K Reputation points
    2023-03-14T17:27:03.4766667+00:00

    Try adding a special instruction:

    Function Calculate_Revenue()
    
       Application.Volatile True
    
       . . .
    End Function
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.