View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Conditional Formatting

You have to do it with code


Sub switch_colors()
Const ColorRed = 3
Const ColorBlue = 5

RowCount = 1
Color1 = ColorRed
Color2 = ColorBlue
MyColor = Color1
Do While Range("C" & RowCount) < ""
Range("C" & RowCount).Interior.ColorIndex = MyColor
If Range("C" & RowCount) < Range("C" & (RowCount + 1)) Then
If MyColor = Color1 Then
MyColor = Color2
Else
MyColor = Color1
End If
End If
RowCount = RowCount + 1
Loop
End Sub


"DBavirsha" wrote:

I am looking for a formula that I could add to conditional formatting to
highlight groups of rows EVERY OTHER time the value changes in a column, say
column C. In my example below if the following values are found in column C,
then the rows containing the 460 values, the 493 values and the 619 values
would all be highlighted, and the rows containing the 481 values and the 610
values would be unhighlighted. If conditional formatting is not the way to
go and I need to use code to accomplish this then I would like the help
writing the code.

Thanks for your help.

Col C
460
460
460
481
481
481
481
493
493
610
610
619
619
619