Conditional Formatting
Gareth
This should do the trick, change the color index to suit.
Sub Frmat()
Dim list As Range, crit As Range
Dim c
Set list = Range("A3:A101")
Set crit = Range("A2")
For Each c In list
If c.Value = crit Then
c.Interior.ColorIndex = 17
End If
Next c
End Sub
Regards
Peter
-----Original Message-----
When I apply the following format to the range A2:A101 it
works fine (if the
same value occurs more than once the cells are
highlighted).
=COUNTIF($A:$A,A2)1
I want to apply this format using code.
Thanks in advance.
Gareth
.
|