Codeblue
07-04-2012, 04:38 PM
I wanted to sort this ss by name and color the rows that have a particular name in it. I tried this
Dim cell As Range
For Each cell In Intersect(Selection, ActiveCell.EntireColumn, _
ActiveSheet.UsedRange)
Select Case cell.Value
Case Is >= "Steve Brock"
cell.EntireRow.Interior.ColorIndex = 20
Case Is >= "Richard Capp"
cell.EntireRow.Interior.ColorIndex = 37
Case Is >= "Brian Garlie"
cell.EntireRow.Interior.ColorIndex = 38
Case Is >= "Johhny Han"
cell.EntireRow.Interior.ColorIndex = 15
Case Is >= "Bruce McCormick"
cell.EntireRow.Interior.ColorIndex = 17
Case Is >= "Kevin McDonald"
cell.EntireRow.Interior.ColorIndex = 24
Case Is >= "Bruce Clark"
cell.EntireRow.Interior.ColorIndex = 27
Case Else
cell.EntireRow.Interior.ColorIndex = 35
End Select
Next cell
Application.ScreenUpdating = True
but it doesn't work..the names are in column C
Dim cell As Range
For Each cell In Intersect(Selection, ActiveCell.EntireColumn, _
ActiveSheet.UsedRange)
Select Case cell.Value
Case Is >= "Steve Brock"
cell.EntireRow.Interior.ColorIndex = 20
Case Is >= "Richard Capp"
cell.EntireRow.Interior.ColorIndex = 37
Case Is >= "Brian Garlie"
cell.EntireRow.Interior.ColorIndex = 38
Case Is >= "Johhny Han"
cell.EntireRow.Interior.ColorIndex = 15
Case Is >= "Bruce McCormick"
cell.EntireRow.Interior.ColorIndex = 17
Case Is >= "Kevin McDonald"
cell.EntireRow.Interior.ColorIndex = 24
Case Is >= "Bruce Clark"
cell.EntireRow.Interior.ColorIndex = 27
Case Else
cell.EntireRow.Interior.ColorIndex = 35
End Select
Next cell
Application.ScreenUpdating = True
but it doesn't work..the names are in column C