w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Search for string on cell starting with two specific letters and highlight entire row

This one works for me:

Sub color1()
    'change Sheet1 to suit
    With ThisWorkbook.Worksheets("Sheet1").Range("A:Z").FormatConditions
        .Delete
        .Add Type:=xlExpression,
Formula1:="=ISNUMBER(MATCH(""ZZ*"",1:1,0))"
        .Item(1).Interior.ColorIndex = 4 'green
        .Add Type:=xlExpression,
Formula1:="=ISNUMBER(MATCH(""ZV*"",1:1,0))"
        .Item(2).Interior.ColorIndex = 6 'yellow
    End With
End Sub

enter image
description here





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.