Blog | Admin | Archives

Excel Routine for Limitless Conditional Formatting


Private Sub Worksheet_Change(ByVal Rng As Range)
Dim R As Integer
Dim G As Integer
    For Each Target In Rng.Cells
        If Not Intersect(Target, Range("AL5:DX177")) Is Nothing Then
            If Target < 1 Then
                G = 255
                R = Target * 255
            Else
                R = 255
                G = 475 - (Target * 255)
            End If   
            Target.Interior.Color = RGB(R, G, 0)
        End If
    Next Target
End Sub

Leave a Reply