View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
SweetSpot SweetSpot is offline
external usenet poster
 
Posts: 4
Default Color alternate Entire row dependant on value in "A"

The xlsweetspot guy says: "Here are some codes that should work without
modification. You just have to decide what column/cell should be used
as the starting point. The code will do the rest."

Sub ColorWhenValueChange()
'The xlsweetspot guy would would do it this way.
Dim strActiveAddress As String 'Use this to track single cell position
ActiveCell.Offset(1, 0).Select
Do While Len(ActiveCell.Value) < 0 ' This will run until a row is
blank.
strActiveAddress = ActiveCell.Address
' Compare the values in the current cell with the one above
If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Then
ActiveCell.EntireRow.Offset(-1, 0).Copy
ActiveCell.EntireRow.PasteSpecial xlPasteFormats
Else
If ActiveCell.Offset(-1, 0).Interior.ColorIndex = xlNone Then
ActiveCell.EntireRow.Select
Selection.Interior.ColorIndex = 15
Else
ActiveCell.EntireRow.Select
Selection.Interior.ColorIndex = xlNone
End If
End If
Range(strActiveAddress).Select
ActiveCell.Offset(1, 0).Select
Loop
End Sub

There is also a row coloring product at xlsweetspot.com that might
solve some concerns.

Good Luck,