原来的问题我写了这样一个程序去模拟:(在A1中输入任意integer, 然后pop up message 告诉变化多少)
Private Sub Worksheet_Change(ByVal Target As Range)
Static i As Integer
i = Range("A1").Value
If Target.Address = "$A$1" Then
If i > Range("B1").Value Then _
MsgBox "value increased by " & i - Range("B1").Value Else _
MsgBox "value decreased by " & Range("B1").Value - i
End If
Application.EnableEvents = False
Range("B1").Value = Range("A1").Value
Application.EnableEvents = True
End Sub
但是这个程序只能在人工手动在A1中输入数据时管用(似乎一定要press enter, 或者tab才行),我的application 是从外面连一个external data 到excel 中, worksheet_change 不能detect 到数据的变化。