返回列表 上一主題 發帖

[發問] 關於篩選與其背景顏色設定問題

Sub yy()
    Dim x$, i%, c As Range
    x = "QWERT"
    For Each c In Range("c:c").SpecialCells(xlCellTypeConstants)
        i = InStr(x, UCase(c))
        If i Then c(1, -1).Resize(, 3).Interior.ColorIndex = i + 2
    Next
End Sub

TOP

回復 8# mark15jill
  1. Sub Ex()
  2.     Dim x(), i, c As Range
  3.     x = Array("陳一", "徐二", "張三", "李四", "王五")
  4.     For Each c In Range("c:c").SpecialCells(xlCellTypeConstants)
  5.         i = Application.Match(c, x, 0)
  6.         If IsNumeric(i) Then c(1, -1).Resize(, 3).Interior.ColorIndex = i + 2  '色盤中的索引值
  7.     Next
  8. End Sub
複製代碼

TOP

        靜思自在 : 【時日莫空過】一個人在世間做了多少事,就等於壽命有多長。因此必須與時間競爭,切莫使時日空過。
返回列表 上一主題