- 帖子
- 2843
- 主題
- 10
- 精華
- 0
- 積分
- 2899
- 點名
- 0
- 作業系統
- 〔略〕
- 軟體版本
- 〔略〕
- 閱讀權限
- 100
- 性別
- 男
- 來自
- 〔略〕
- 註冊時間
- 2013-5-13
- 最後登錄
- 2025-6-9
|
19#
發表於 2015-8-23 10:24
| 只看該作者
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r&, t$, c
With Target
If .Count > 1 Or .Row < 12 Then Exit Sub Else r = .Row
If Application.Mode(Array(.Column, 7, 18, 20, 21, 0, 0)) = 0 Then Exit Sub
End With
On Error GoTo 1
Application.EnableEvents = False
If Cells(r, "G") = "" Then Cells(r, "V").Resize(1, 3) = "": GoTo 1
Cells(r, "V") = Cells(r, "R") + Cells(r, "T") + Cells(r, "U")
Cells(r, "W") = Cells(r, "G") - Cells(r, "V")
If Cells(r, "W") = 0 Then t = "結": c = 41
If Cells(r, "V") > Cells(r, "G") Then t = "資料錯誤": c = 0
Cells(r, "X") = t
Cells(r, "X").Font.ColorIndex = c
1: Application.EnableEvents = True
End Sub |
|