Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

In this example I will apply "Conditional Formatting" - Highlight Duplicates in Red just like via the GUI.

Sub Dup_Cond_Form(rng As Range)
Dim rng As Range

    rng.FormatConditions.AddUniqueValues
    rng.FormatConditions(rng.FormatConditions.Count).SetFirstPriority
    rng.FormatConditions(1).DupeUnique = xlDuplicate
    With rng.FormatConditions(1).Font
        .Color = -16383844
        .TintAndShade = 0
    End With
    With rng.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .Color = 13551615
        .TintAndShade = 0
    End With
    rng.FormatConditions(1).StopIfTrue = False

End Sub

  • No labels