Hi folks,
I have the follwing code that will turn the ajoining cell to a particular color based on the Month of a date that is formated 1/12/06.
I need to expand on this code so it will also look at the Year. This spreedsheet will run into the next year so just looking at the month will not do. Of course I would change the color index for the next year to something else.
This continues for all twelve months (Case 12)
Any help would be greatly appreciated.
Thanks
h.h.
I have the follwing code that will turn the ajoining cell to a particular color based on the Month of a date that is formated 1/12/06.
I need to expand on this code so it will also look at the Year. This spreedsheet will run into the next year so just looking at the month will not do. Of course I would change the color index for the next year to something else.
Code:
Sub ColorByMonth()
Dim rCell As Range
Application.ScreenUpdating = False
Application.Calculate
On Error GoTo Xit
For Each rCell In Range("j2:j" & Range("j65536").End(xlUp).Row)
Select Case Month(rCell)
Case 1
rCell.Offset(0, 1).Interior.ColorIndex = 36
Case 2
rCell.Offset(0, 1).Interior.ColorIndex = 42
Case 3
rCell.Offset(0, 1).Interior.ColorIndex = 39
This continues for all twelve months (Case 12)
Any help would be greatly appreciated.
Thanks
h.h.