返回列表 上一主題 發帖

如何依據儲存格的內容改變右邊儲存格的底色

  1. Sub Ex()
  2. Dim A As Range
  3. If Application.CountA(Columns("A")) > 0 Then
  4. For Each A In Range("A:A").SpecialCells(xlCellTypeConstants)
  5. Select Case Left(A, 1)
  6. Case "A"
  7. s = 3
  8. Case "B"
  9. s = 6
  10. Case "C"
  11. s = 5
  12. End Select
  13. A.Offset(, 1).Interior.ColorIndex = s
  14. Next
  15. End If
  16. End Sub
複製代碼
學海無涯_不恥下問

TOP

回復 3# deyan

我測試OK,或許你執行位置錯誤
  請上傳您的附件看看為何不行
學海無涯_不恥下問

TOP

        靜思自在 : 虛空有盡.我願無窮,發願容易行願難。
返回列表 上一主題