The routine I tried to implement using “Private Sub Worksheet_Change(byval Target As Range)” works well, when the value change of the cell (“True” to “False” or “False” to “True”) is done by me, by the keyboard, but not when the change is a consequence of other cells. Is there any way to call a macro when changing a cell value is a consequence of other cells?
I drop the code I’m using, but that responds only to changes in the target cell state made by the keyboard.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells1 As Range
Dim KeyCells2 As Range
Set KeyCells1 = Range("D8") 'Seleção de ativo
Set KeyCells2 = Range("F42") ' Estado do alarme
If Not Application.Intersect(KeyCells1, Range(Target.Address)) _
Is Nothing Then
Macro1
End If
If Not Application.Intersect(KeyCells2, Range(Target.Address)) _
Is Nothing Then
Macro2
End If
End Sub
ANDRÉ DA MATTA ANDRE DA MATTA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.