automatically execute an Excel macro on a cell change

前端 未结 5 1960
无人及你
无人及你 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:45

    Handle the Worksheet_Change event or the Workbook_SheetChange event.

    The event handlers take an argument "Target As Range", so you can check if the range that's changing includes the cell you're interested in.

提交回复
热议问题