|
Private Sub Worksheet_Change(ByVal Target As Range)
Set xTarget = Application.Intersect(Target, [A3:C8])
If xTarget Is Nothing Then Exit Sub
For Each xT In xTarget
Application.EnableEvents = False '停止觸發事件
r = xT.Row: c = xT.Column
If c = 1 And Cells(r, 1) > 0 Then
Cells(r, 2) = Application.Lookup(xT, [{0,"";50,20;101,25;201,28;301,""}])
ElseIf c = 1 Then
Cells(r, 2) = ""
End If
If Cells(r, 2) > 0 And Cells(r, 3) > 0 Then
Cells(r, 4) = Cells(r, 2) * Cells(r, 3)
Else
Cells(r, 4) = ""
End If
[d9] = Application.Sum([d3:d8])
Application.EnableEvents = True '啟動觸發事件
Next
End Sub
Sub 啟動觸發事件()
Application.EnableEvents = True '啟動觸發事件
End Sub |
评分
-
1
查看全部评分
-
|