Currently able to do a VBA search on a column range like H:H and apply conditional formatting if any cells in H:H has a partial match against cell A1, which might be "LTD". However, i'm struggling to find a code that allows me to expand partial matches to cell B1 "CO" and C1 "LLC" against H:H. Ideally I want to look at multiple cells against H:H with one code, rather than having to run the code multiple times to get the conditional formatting.
The VBA code is below:
Private Sub CommandButton1_Click()
Dim Partial_Text As String
Dim myrange As Range
Partial_Text = Worksheets("Workbook").Cells(1, 1).Value
Set myrange = Worksheets("Workbook").Range("H:H")
myrange.Interior.Pattern = xlNone
For Each cell In myrange
If InStr(LCase(cell.Value), LCase(Partial_Text)) <> 0 Then cell.Interior.ColorIndex = 4
Next
End Sub
Is anyone able to help me and improve on this?
Thank you!
Tried the code above and would like a solution that allows me to run the VBA code once, as opposed to multiple times. The reason I ran VBA code, is because in standard excel formulas wildcards aren't picking up the partial matches, but VBA does.