View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Interior color based on dates

Hi Michael,

Try:


Sub ColorByMonth2()
Dim Rng As Range
Dim rCell As Range

Set Rng = Intersect(ActiveSheet.UsedRange, Columns("A:J"))

For Each rCell In Rng.Cells
If IsDate(rCell) Then
With rCell.Interior
Select Case Month(rCell.Value)
Case 1: .ColorIndex = 35
Case 2: .ColorIndex = 3
Case 3: .ColorIndex = 4
Case 4: .ColorIndex = 5
Case 5: .ColorIndex = 6
Case 6: .ColorIndex = 15
Case 7: .ColorIndex = 16
Case 8: .ColorIndex = 17
Case 9: .ColorIndex = 18
Case 10: .ColorIndex = 19
Case 11: .ColorIndex = 8
Case 12: .ColorIndex = 7
End Select
End With
End If
Next
End Sub

You may wish to try changing the color index numbers to match your personal
predilections.

---
Regards,
Norman



"Michael Wise"
wrote in message
news:Michael.Wise.1rem6n_1120075563.7459@excelforu m-nospam.com...

I have a worksheet that I want a specific color each month in the lowest
found date. I want a constant color to be with the lowest date. For
example if in my data range the lowest Month is 6/1/05 I wish it to be
light blue and the next date change month to 7/1/05 to be light green.
The color I wish to be constant in there placement but the date will
always be changing. The date are sorted. Also the colors only need to
be changed if the month itself is different not the days of the month.
This should happen from row 2 on. So all rows in the current month
would be light blue all next month rows would be light green, all next
month after that rows would be light yellow, anything beyond that is
N/A. The Interior fill only needs to be applied to columns A:J. I hope
this makes sense and i've explained well enough. TIAdvance
Michael


--
Michael Wise
------------------------------------------------------------------------
Michael Wise's Profile:
http://www.excelforum.com/member.php...fo&userid=6998
View this thread: http://www.excelforum.com/showthread...hreadid=383309