Trigger Macro on Range and Sheet Changes
I always seem to spend ten minutes trying to find these snippets of code on the Internet when I need them. For reference . . .
To trigger a macro on a change in range, load the procedure below into a sheet module. It will fire when a change is made to the range A1:A5.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("A1:A5")) Is Nothing Then
Your Code Here
End If
End Sub
To trigger a macro on a change in the sheet, load the procedure below into a sheet module. It will fire when a change is made to any cell on the sheet:
Private Sub Worksheet_Change(ByVal Target As Range)
Your Code Here
End Sub
Comments
Comment Form