automatically execute an Excel macro on a cell change

前端 未结 5 1933
无人及你
无人及你 2020-11-22 14:16

How can I automatically execute an Excel macro each time a value in a particular cell changes?

Right now, my working code is:

Private Sub Worksheet_C         


        
5条回答
  •  天涯浪人
    2020-11-22 14:34

    I have a cell which is linked to online stock database and updated frequently. I want to trigger a macro whenever the cell value is updated.

    I believe this is similar to cell value change by a program or any external data update but above examples somehow do not work for me. I think the problem is because excel internal events are not triggered, but thats my guess.

    I did the following,

    Private Sub Worksheet_Change(ByVal Target As Range) 
      If Not Intersect(Target, Target.Worksheets("Symbols").Range("$C$3")) Is Nothing Then
       'Run Macro
    End Sub
    

提交回复
热议问题