Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

can I color true or false results differently in excel

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JT - 11 Apr 2008 03:41 GMT
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(WEEKDAY(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?
Mark Ivey - 11 Apr 2008 03:53 GMT
What about just using conditional formatting?

Mark Ivey

> I want to identify the day of the week in my spreadsheet and have used the
> formula
[quoted text clipped - 4 lines]
> weekdays (M-F) to be black and have SA and SU come up red.  any ideas /
> suggestions?
JT - 11 Apr 2008 22:17 GMT
I think that both of you guys are WAY ABOVE my programming level.  Thanks for
the help but I think I should have put my question in the beguinners category
since I really don't know what conditional formatting is let alone how to do
it.

sorry to waste your time.
JT
JT - 11 Apr 2008 22:50 GMT
Strike my reply to your answer Mark.  I just found a link to conditional
formating and, WOW, what a powerful tool.  Great suggestion!  Now my weekdays
are black with Green background and the weekends are white with red
backgrounds.  More than I had in mind.  

If I did this right the link that I followed was
http://www.contextures.com/xlCondFormat01.html
if not, then this is the webpage I used.  (Like I said, I am not much of a
programmer, typical 52 year old who didn't get his first computer till he was
40'ish)

Thanks again Mike.
JT
Mike - 11 Apr 2008 04:21 GMT
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

> I want to identify the day of the week in my spreadsheet and have used the
> formula
[quoted text clipped - 4 lines]
> weekdays (M-F) to be black and have SA and SU come up red.  any ideas /
> suggestions?
JT - 11 Apr 2008 22:27 GMT
I think that both of you guys are WAY ABOVE my programming level.  Thanks for
the help but I think I should have put my question in the beguinners
category.  I have tried to copy the subroutine that you sent to several cells
in my worksheet and either get text of the subroutine or, if I start it with
"=" and the subroutine all in one cell, excell calls an error and highlights
the term ".value" in the subroutine.  I have also tried messing with the With
Range("B2") line and tried both With Range(O20) {a cell that is Saturday} and
With Range(O2:O32) {the 31 cells to correspond to the 31 possible dates per
month}  and had no luck.

Thanks for the effort.
sorry to waste your time.
JT
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.