Thread: Colour rows
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
excelent excelent is offline
external usenet poster
 
Posts: 695
Default Colour rows

this one reset color
If Target = "" Then Target.EntireRow.Interior.ColorIndex = xlNone


"excelent" skrev:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("G12:G2000")) Is Nothing Then Exit Sub
If Target = "FU" Then Target.EntireRow.Interior.ColorIndex = 4
If Target = "FR" Then Target.EntireRow.Interior.ColorIndex = 46
If Target = "SU" Then Target.EntireRow.Interior.ColorIndex = 6
If Target = "PE" Then Target.EntireRow.Interior.ColorIndex = 3
If Target = "NS" Then Target.EntireRow.Interior.ColorIndex = 2
If Target = "CL" Then Target.EntireRow.Interior.ColorIndex = 9

End Sub


"John D" skrev:

I have tried the following code which was in "VBA - Coloring Rows Instead of
Cells" question earlier however it doesn't work for me so maybe I have done
something wrong.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

If Not Intersect(Target, Range("G12:G2000")) Is Nothing Then
Select Case Target
Case "FU"
icolor = 4
Case "FR"
icolor = 46
Case "SU"
icolor = 6
Case "PE"
icolor = 3
Case "NS"
icolor = 2
Case "CL"
icolor = 9
Case Else
'Whatever
End Select

Target.EntireRow.Interior.ColorIndex = icolor
End If

End Sub






"John D" wrote:

I have never used VBA so this might be very basic. I have an excel
spreadsheet and on it is a column that the user can place different initials
to indicate status of client e.g. FU; FR; SU; PE and so on. I am wanting if
its possible to have excel colour the row with a different colour for each
variation.
Can anyone suggest anything please?