Aktif Hücreye Girilen Rakama Göre Renklendir - Microsoft Excel


Aktif hücreye sayı girişi yapıldığında verilen renk bilgilerine göre renklendirme işlemi yapan VBA kodu alternatifidir.

Kod


Option Explicit

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    Select Case Target.Value
        Case 1
            Target.Interior.ColorIndex = 22
        Case 2
            Target.Interior.ColorIndex = 39
        Case 3
            Target.Interior.ColorIndex = 6
        Case 4
            Target.Interior.ColorIndex = 7
        Case 5
            Target.Interior.ColorIndex = 8
        Case 6
            Target.Interior.ColorIndex = 47
        Case 7
            Target.Interior.ColorIndex = 43
        Case 8
            Target.Interior.ColorIndex = 44
        Case 9
            Target.Interior.ColorIndex = 45
        Case 0
            Target.Interior.ColorIndex = 50
        Case Else
            Target.Interior.ColorIndex = xlColorIndexNone
    End Select
End Sub

Etiketler
microsoft excel microsoft excel vba microsoft excel vba çalışma sayfası işlemleri