View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default Shading Rows With IF Statements?

You need VBA.


'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "DW:DW" '<=== change to suit

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Select Case .Value
Case "L": .EntireRow.Interior.ColorIndex = 48 '40% grey
Case "F": .EntireRow.Interior.ColorIndex = 5 'blue
'etc
Case Else: .EntireRow.Interior.ColorIndex = xlColorIndexNone
End Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.





--
__________________________________
HTH

Bob

"JPS" wrote in message
...
I have a large spreadsheet and based on a status indicator in Column DW, I
need to shade the entire row one of eight colors, For example, if a cell
value in row DW is L the whole row needs to be shaded gray. Another
example.
is if DW is F, the row needs to be Blue. If DW is blank, the row is not
shaded. Is this doable with IF statements; I already use Conditional
Formatting for another purpose. I am using Excel 2003
--
JPS