Adding

This will add conditional formatting to cells "A2:C8" indicating the smallest number in each row, excluding zeros.

Sub ApplyConditionalFormatting() 

Dim oFormatCondition As FormatCondition

    On Error Resume Next
    Set oFormatCondition = Range("A2:C8").FormatConditions(1)
    oFormatCondition.Delete
    On Error GoTo 0

    Range("A2:C8").Select
    Set oFormatCondition = Range("A2:C8").FormatConditions.Add( _
        XlFormatConditionType.xlExpression, , _
        "=A2=SMALL($A2:$C2,COUNTIF($A2:$C2,0)+1)")

    With oFormatCondition
        .Interior.Color = RGB(212, 152, 112)
    End With
End Sub


© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext