本帖最后由 爱疯 于 2015-7-3 15:35 编辑
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r, c
r = Target.Row: c = Target.Column
'假设指定范围是 B2:D3
If r > 1 And r < 4 And c > 1 And c < 5 Then MsgBox "指定范围中,发生了值改变"
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, [d5:f8]) Is Nothing Then MsgBox "指定范围中,发生了值改变"
'Application.Intersect 方法
'返回一个 Range 对象,该对象表示两个或多个区域重叠的矩形区域。
'假设指定范围是 D5:F8
End Sub
两种常见方式。
如果需要,再加条件 target.count
2.rar
(8.6 KB, 下载次数: 3)