简体   繁体   English

在Excel中的一列中检测单元格更改

[英]Detect cell change in one column in Excel

I want to use the Worksheet_Change(ByVal Target As Range) to detect changes to the worksheet, but I only want to detect changes to column A. 我想使用Worksheet_Change(ByVal Target As Range)来检测对工作表的更改,但是我只想检测对A列的更改。

Is it possible to restrict the detection to just that range? 是否可以将检测范围限制在该范围?

You can use this code. 您可以使用此代码。 Note that it will only be triggered by manually changing cells in column A . 请注意,只能通过手动更改A列中A单元格来触发它。 Changes triggered by calculations won't be captured. 计算触发的更改将不会被捕获。

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Target.Column = 1 Then
       'your code
    End If
End Sub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM