- 帖子
- 472
- 主題
- 5
- 精華
- 0
- 積分
- 485
- 點名
- 0
- 作業系統
- Windows
- 軟體版本
- MS Office
- 閱讀權限
- 100
- 性別
- 男
- 來自
- 香港
- 註冊時間
- 2010-7-4
- 最後登錄
- 2014-12-28

|
本帖最後由 kimbal 於 2013-10-3 23:34 編輯
回復 1# ji12345678 - Sub TEST()
- Dim color As Long
- Application.Calculation = xlCalculationManual
- Application.ScreenUpdating = False
-
- Sheets("總表").Copy after:=Sheets(1)
- With ActiveSheet.Range("B3")
- Range(.Address, .End(xlToRight).End(xlDown)).ClearFormats
- Range(.Address, .End(xlToRight).Offset(0, -1).End(xlDown)).Select
- Selection.Copy
- .Offset(0, 1).PasteSpecial operation:=xlPasteSpecialOperationSubtract
-
-
- For Each Rng In Range(.Offset(0, 1), .End(xlToRight).End(xlDown))
- color = 0
- If Rng.Row >= 12 And Rng.Row <= 17 Then
- If Rng.Value > 0 Then
- color = 15773696
- ElseIf Rng.Value < 0 Then
- color = 52479
- End If
- Else
- If Rng.Value > 0 Then
- color = 255
- ElseIf Rng.Value < 0 Then
- color = 5296274
- End If
- End If
- If color > 0 Then
- With Rng.Interior
- .Pattern = xlSolid
- .PatternColorIndex = xlAutomatic
- .color = color
- End With
- End If
- Next
- Range(.Address, .End(xlDown)).Clear
- End With
- Application.ScreenUpdating = True
- Application.Calculation = xlCalculationAutomatic
- End Sub
複製代碼 |
|