Hi Team,
Below code works for exact cells match for list of Array value,
Now I am looking for Contains, instead of exact match.
Example-
if Array value Contain Red, and Cell value Contain Redish,
then Still it has bold that cell. Because Red is Contained in cell value....
Sub test()
Dim ar As Variant
ar = WorksheetFunction.Transpose(Sheet1.Range("G2:g5").Value) 'array("Green",Red","Yellow"
or
' ar = Sheet1.Range("G2:g5").Value)
Dim lr As Long
Dim i As Long
lr = Sheet1.Range("a1000").End(xlUp).Row
For i = 2 To lr 'List of Color
If IsNumeric(Application.Match(Sheet1.Cells(i, 1).Value, ar, 0)) Then
Sheet1.Cells(i, 1).Font.Bold = True
End If
Next i
End Sub
Regards,
mg
Below code works for exact cells match for list of Array value,
Now I am looking for Contains, instead of exact match.
Example-
if Array value Contain Red, and Cell value Contain Redish,
then Still it has bold that cell. Because Red is Contained in cell value....
Sub test()
Dim ar As Variant
ar = WorksheetFunction.Transpose(Sheet1.Range("G2:g5").Value) 'array("Green",Red","Yellow"
or
' ar = Sheet1.Range("G2:g5").Value)
Dim lr As Long
Dim i As Long
lr = Sheet1.Range("a1000").End(xlUp).Row
For i = 2 To lr 'List of Color
If IsNumeric(Application.Match(Sheet1.Cells(i, 1).Value, ar, 0)) Then
Sheet1.Cells(i, 1).Font.Bold = True
End If
Next i
End Sub
Regards,
mg