I'm trying to imlpement a code that displays a message when a certain condition is met. In this case, it should happen when Sheet2's A1's
value is equal or bigger than 1000. This value, on the other hand, is defined by a formula located in Sheet1
. I tried implementing a solution based on this thread: How can I run a VBA code each time a cell get is value changed by a formula?
So I got this:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim updatedCell As Range
Set updatedCell = Range("A1")
If Not Application.Intersect(updatedCell, Range("A:A")) Is Nothing Then
If updatedCell.Value >= 1000 Then
MsgBox "Something requires attention"
End If
End If
End Sub
When I change the value of A1
through something from Sheet2
, it works, but if for example I define it as =Sheet1!A7
, and change Sheet1's A7
, nothing happens.
How could I make it work?