View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike Mike is offline
external usenet poster
 
Posts: 3,101
Default can I color true or false results differently in excel

Paste this code into the worksheet that your formula is in
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Range("B2")
Select Case .Value
Case "M", "T", "W", "TH", "F"
.Interior.ColorIndex = 1
.Font.ColorIndex = 2
Case "SA", "SU"
.Interior.ColorIndex = 3
.Font.ColorIndex = 2
Case Else
.Interior.ColorIndex = 2
.Font.ColorIndex = 1
End Select
End With
End Sub

"JT" wrote:

I want to identify the day of the week in my spreadsheet and have used the
formula

=IF(WEEKDAY(L2)=1,"SU",IF(WEEKDAY(L2)=2,"M",IF(WEE KDAY(L2)=3,"T",IF(WEEKDAY(L2)=4,"W",IF(WEEKDAY(L2) =5,"TH",IF(WEEKDAY(L2)=6,"F",IF(WEEKDAY(L2)=7,"SA" ,"")))))))

where the L2 cell would have a date (ie 04/10/2008) but would like the
weekdays (M-F) to be black and have SA and SU come up red. any ideas /
suggestions?