Conditional formatting
Try the below macro with data in ColA
Sub Macro1()
Dim lngRow As Long, blnChange As Boolean
For lngRow = 2 To Cells(Rows.Count, "A").End(xlUp).Row
If Range("A" & lngRow) < Range("A" & lngRow - 1) Then blnChange = Not
blnChange
Range("A" & lngRow).Interior.ColorIndex = IIf(blnChange = False, xlNone, 15)
Next
End Sub
--
Jacob
"puiuluipui" wrote:
Hi, i need a way to use conditional formatting or another way to highlight
cells based on duplicate names group.
Ex:
1 john
2 john
3 john
4 mary
5 mary
6 jim
7 cris
8 cris
9 cris
I need all cells with john to be highlighted with one colour, the next group
(mary) with another color, the next group (jim) with another color....and so
on.
All names will be ascending.
Can this be done?
Thanks!
|