- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
回復 3# a122
練習看看- Option Explicit
- Sub Ex()
- With ActiveSheet.Range("B5:B100") '範圍儲存格
- .Cells(1).Activate '作用中儲存格,為公式參照基準點.
- .FormatConditions.Delete
- .FormatConditions.Add Type:=xlExpression, Formula1:="=" & .Cells(1, 0).Address(0, 0) & ">" & .Cells(1).Address(0, 0) 'Formula1:="=A5>B5"
- .FormatConditions(1).Interior.ColorIndex = 6
- .FormatConditions.Add Type:=xlExpression, Formula1:="=" & .Cells(1, 0).Address(0, 0) & "<" & .Cells(1).Address(0, 0) 'Formula1:="=A5<B5"
- .FormatConditions(2).Interior.ColorIndex = 42
- End With
- End Sub
複製代碼 |
|