I have a spreadsheet, which uses an external add-on that updates values in a cell. Notice, the cell is not changed, only the value is updated.
I would like to run a macro every time the cell is updated.
To simulate the problem:
Create an empty excel sheet
In cell A1 add the formula '=rand()'
In VBA add a macro for sheet1, here a simplified version:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" Then Cells(1, 3).Value = "The function updated" End If
End Sub
However, when I thereafter press F9 (to update the random numbers), the sheet does not recognize this as a sheet change, hence the macro is not run. How can I make the macro run when e.g. a random number in the sheet i updated?
Application.Calculate
event to detect when the value might have changed and some functionality to check if the actual value of the cell(s) have changed since the event was last triggered. – CLRrand
function in their example. – CLR