- 帖子
- 967
- 主題
- 0
- 精華
- 0
- 積分
- 1001
- 點名
- 0
- 作業系統
- WIN XP
- 軟體版本
- OFFICE 2003
- 閱讀權限
- 50
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-11-29
- 最後登錄
- 2022-5-17
|
22#
發表於 2012-2-27 22:09
| 只看該作者
回復 21# appr - Private Sub worksheet_change(ByVal target As Range)
- Set RngA = Range("A2:A4")
- Set RngB = Range("B2:B4")
- Set RngCA = Intersect(target, RngA)
- Set RngCS = Intersect(target, RngB)
- If Not RngCA Is Nothing Then
- RngCA.Offset(0, 2) = RngCA.Offset(0, 2) + RngCA.Value
- RngCA.Offset(0, Month(Now) + 4) = RngCA.Offset(0, Month(Now) + 4) + RngCA.Value
- RngCA.Value = ""
- End If
- If Not RngCS Is Nothing Then
- RngCS.Offset(0, 1) = RngCS.Offset(0, 1) - RngCS.Value
- RngCS.Value = ""
- End If
- Set RngD = Range("D2:D4")
- Set RngE = Range("E2:E4")
- Set RngDE = Intersect(target, RngD)
- Set RngED = Intersect(target, RngE)
- If Not RngDE Is Nothing Then 'E2~E4=D2~D4
- RngE.Value = RngD.Value
- End If
- If Not RngED Is Nothing Then 'D2~D4=E2~E4
- RngD.Value = RngE.Value
- End If
- End Sub
複製代碼 |
|