Seçilen Alanı Renklendir - Microsoft Excel


Seçilen alanı renklendirmeye yarayan VBA kodu alternatifidir.

Kod


Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Static oncekiHucre As Range
    
    If Target.Interior.ColorIndex <> xlColorIndexNone Then
        oncekiHucre.Interior.ColorIndex = xlColorIndexNone
        Exit Sub
    ElseIf Not oncekiHucre Is Nothing Then
        oncekiHucre.Interior.ColorIndex = xlColorIndexNone
    End If
    
    Target.Interior.ColorIndex = 6
    Set oncekiHucre = Target
End Sub

Etiketler
microsoft excel açıklamalı içerik microsoft excel vba