PC Review


Reply
Thread Tools Rate Thread

COlor Coding specified time frames

 
 
Kim
Guest
Posts: n/a
 
      21st Jul 2008
I am attemtpting to use validation with date function. Example: I have a
booked date and a specimen date. I want the cell to turn a specific color if
the booked date and specimen date is 0-1 days, another color for 2-3 days,
etc. Is this possible? I can apply conditional formating to a date just one
day greater than my booked date. But that is as far as I can get with the
cell coloring.
 
Reply With Quote
 
 
 
 
Corey ....
Guest
Posts: n/a
 
      22nd Jul 2008
Try this (It is in the WorkSheet Slection Change Event:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cell As Range
Dim PSP As Worksheet
Set PSP = Worksheets("Sheet1") ' <===== Modify to suit Sheet
For Each cell In PSP.Range("A1:R47") ' <===== Modify to Suit Range
If cell.Value <> "" Then
If (cell.Value - Date) < 1 Then
With cell.Interior
.ColorIndex = 38 ' Modify Colors as required
.Pattern = xlSolid
End With
ElseIf (cell.Value - Date) <= 1 Then ' Modify Number of days here
With cell.Interior
.ColorIndex = 36 ' Modify Colors as required
.Pattern = xlSolid
End With
ElseIf (cell.Value - Date) > 3 Then ' Modify Number of days here
With cell.Interior
.ColorIndex = 35 ' Modify Colors as required
.Pattern = xlSolid
End With
ElseIf (cell.Value - Date) > 1 And (cell.Value - Date) <= 3 Then ' Modify
Number of days here
With cell.Interior
.ColorIndex = 4
.Pattern = xlSolid
End With
End If
End If
Next
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Regards
Ctm...



"Kim" <Kim @discussions.microsoft.com> wrote in message
news:10331DCC-1282-4BD2-93F3-(E-Mail Removed)...
>I am attemtpting to use validation with date function. Example: I have a
> booked date and a specimen date. I want the cell to turn a specific color
> if
> the booked date and specimen date is 0-1 days, another color for 2-3 days,
> etc. Is this possible? I can apply conditional formating to a date just
> one
> day greater than my booked date. But that is as far as I can get with the
> cell coloring.



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I subtract time where hh:mm:ss:ff (frames = 30 frames/sec) =?Utf-8?B?S0o3?= Microsoft Excel Misc 7 12th Feb 2010 02:25 PM
color coding Kimi Mac Microsoft Outlook Calendar 1 25th Feb 2009 01:43 PM
Color coding based on time elapsed Bill Microsoft Access VBA Modules 2 11th Feb 2009 08:25 PM
Frames And Headings, No Color In Emai =?Utf-8?B?TWVs?= Windows XP General 0 7th Sep 2007 03:40 AM
Frames color problem =?Utf-8?B?Sm9obiBHcmVlY2U=?= Microsoft Frontpage 1 15th Jan 2005 08:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:11 PM.