1. 請問此程序宣告用那個(或如何修改)較省資源??
2. 用 Private Sub Worksheet_Change() 為何出現 事件程序的宣告與同名事件的描述不相符
Private Sub Worksheet_Calculate()
' Private Sub Worksheet_Change(ByVal Target As Range)
' Private Sub Worksheet_Change()
Dim rng As Range
For Each rng In Range("AL5:AL15") 'Range("AL5:AL15") 為dde連結
m = rng - rng.Offset(0, 9)
'------------------------------
If m > rng.Offset(0, 8) Then
MsgBoxTest 0, rng.Offset(0, -1) & " 注意 ", "提示訊息", vbSystemModal, 0, 2000
Application.EnableEvents = False
rng.Offset(0, 9) = rng
Application.EnableEvents = True
End If
'------------------------------------------
If m < -rng.Offset(0, 8) Then
MsgBoxTest 0, rng.Offset(0, -1) & " 注意 ", "提示訊息", vbSystemModal, 0, 2000
Application.EnableEvents = False
rng.Offset(0, 9) = rng
Application.EnableEvents = True
End If
'------------------------------------------------
Next
End Sub作者: GBKEE 時間: 2014-10-13 05:45