返回列表 上一主題 發帖

[發問] 儲存格格式化設定

回復 3# a122
練習看看
  1. Option Explicit
  2. Sub Ex()
  3.     With ActiveSheet.Range("B5:B100")  '範圍儲存格
  4.             .Cells(1).Activate  '作用中儲存格,為公式參照基準點.
  5.             .FormatConditions.Delete
  6.             .FormatConditions.Add Type:=xlExpression, Formula1:="=" & .Cells(1, 0).Address(0, 0) & ">" & .Cells(1).Address(0, 0) 'Formula1:="=A5>B5"
  7.             .FormatConditions(1).Interior.ColorIndex = 6
  8.             .FormatConditions.Add Type:=xlExpression, Formula1:="=" & .Cells(1, 0).Address(0, 0) & "<" & .Cells(1).Address(0, 0) 'Formula1:="=A5<B5"
  9.             .FormatConditions(2).Interior.ColorIndex = 42
  10.     End With
  11. End Sub
複製代碼
感恩的心......(在麻辣家族討論區.用心學習會有進步的)
但資源無限,後援有限,  一天1元的贊助,人人有能力.

TOP

        靜思自在 : 改變自己是自救,影響別人是救人。
返回列表 上一主題