How to keep previous colour ater using Target.Colour.Index

  • Hi friends,

    With below code, I can get red color in modified cells. After some time or days I will change red colored cells into no color, but that time previous color also removing. How can I keep my original color. Please check sample workbook.

    [VBA]Option Explicit

    Private Sub Worksheet_Change(ByVal Target As Range)

    Application.ScreenUpdating = False
    Application.EnableEvents = False

    Target.Interior.ColorIndex = 3
    Target.Font.Bold = True

    Application.EnableEvents = True
    Application.ScreenUpdating = True
    End Sub

    [VBA]Sub Color()
    Dim myRange As Range
    Dim cell As Range
    Set myRange = Range("A1:AU1200")
    For Each cell In myRange
    If cell.Interior.ColorIndex = 3 And _
    cell.Font.Bold = True Then
    cell.Interior.ColorIndex = 0
    cell.Font.Bold = False

    End If
    End Sub


    Thank you Friends,

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!