VBA trigger macro on cell value change

前端 未结 4 1909
青春惊慌失措
青春惊慌失措 2020-12-17 05:07

This should be simple. When the value of a cell changes I want to trigger some VBA code. The cell (D3) is a calculation from two other cells =B3*C3. I have atte

4条回答
  •  清酒与你
    2020-12-17 05:28

    try this:

     Sub Worksheet_Change(ByVal Target As Range)
    
        If Not Intersect(Target, Target.Worksheet.Range("B1")) Is Nothing Then
    
          Call macro
    
        End If
    
     End Sub
    

    looks for a change in value of cell B1, then executes "macro"

提交回复
热议问题