Skip to content

Instantly share code, notes, and snippets.

@elbeicktalat
Last active December 11, 2023 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbeicktalat/8c1c02426e8c771dd361c38b39b8e6e9 to your computer and use it in GitHub Desktop.
Save elbeicktalat/8c1c02426e8c771dd361c38b39b8e6e9 to your computer and use it in GitHub Desktop.
Excel cell change event listener
' 1) Open the developer mode
' 2) On the left bar, under `Microsoft Excel Objects` tab open your sheet you want to observe changes
' 3) Paste the code you find below
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
' The variable KeyCells contains the cells that will
' run you code when they are changed.
Set KeyCells = Range("A1:A3")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
' Runs whenever the KeyCells changed.
' Place your code here.
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment