View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Group Highlighting

Hi,

I assume column A. Right click your sheet tab, view code and paste this in
and run it


Sub prime_Lending()
icolour = 3
Range("A1").Interior.ColorIndex = icolour
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set myrange = Range("A2:A" & lastrow)
For Each c In myrange
If c.Value = c.Offset(-1).Value Then
c.Interior.ColorIndex = icolour
Else
If c.Offset(-1).Interior.ColorIndex = 3 Then
icolour = 6
Else
icolour = 3
End If
c.Interior.ColorIndex = icolour
End If
Next
End Sub

Mike


"Dorian C. Chalom" wrote:

I have a spreadsheet of

123
123
123
456
456
456
789
234
234
234

I want 123 to be shaded one color
456 another color
and 234 the same color of 123
and go on that way
hieghtlighting the group of records alternatiing colors
How might I go about doing this?

Thank you...