excel VBA run macro automatically whenever a cell is changed

前端 未结 5 1643
礼貌的吻别
礼貌的吻别 2020-11-27 20:54

Is there a simple way to get Excel to automatically execute a macro whenever a cell is changed?

The cell in question would be in Worksheet(\"BigBoard\").Range(

5条回答
  •  盖世英雄少女心
    2020-11-27 21:46

    In an attempt to find a way to make the target cell for the intersect method a name table array, I stumbled across a simple way to run something when ANY cell or set of cells on a particular sheet changes. This code is placed in the worksheet module as well:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count > 0 Then
    'mycode here
    end if
    end sub
    

提交回复
热议问题