Automatically execute excel macro on cell modified in real time by add-in

I have an Excel add-in (Bloomberg) that translates real-time prices into a spreadsheet. I need to add a column that contains the last time the price was updated. I tried to do this with a worksheet change event, but it doesn't seem to be triggered by the changes (I'm guessing it has to do with the fact that it's a realtime update).

The requirement is the same as the question below, but the solutions do not apply as events are not fired in that case.

automatically runs Excel macro when cell changes

+2


source to share


1 answer


Using another forum, I found an easy way to do this.

First, define a function as shown below in a VBA module available for a worksheet:



Public Function GetTime(target As Double) As Double
    GetTime = Now()
End Function

      

Then, in the "last updated" column, add a call to this function with a formula pointing to the cell you want to control. Whenever the target cell is updated, even from a live update, the function is triggered and forces the time to update.

+1


source







All Articles