I have an excel 2002 file with a calender in it.
above it are 8 date ranges.
i need the calender dates to be different colors depending on which date range they fall within.
any ideas folks?
thanks
I have an excel 2002 file with a calender in it.
above it are 8 date ranges.
i need the calender dates to be different colors depending on which date range they fall within.
any ideas folks?
thanks
Hi,
I haven't tested this but it may give you some starting points.
You will need to change the cell references, etc to match you spreadsheet.
[VBA]
Set CalRng = Range("A21:G54") "your calendar ranges"
Set EnDate = "your cell reference for end date"
Set StDate = "your cell reference for start date"
For Each c In CalRng
c.Select
'Test if cell blank
If c <> "" Then
'Test if cell > End Date to exit for/each to goto next row
If c > EnDate Then
Exit For
Else
'Test if the cell value is >=Start Date and <= End Date
If c >= StDate And c <= EnDate Then
c.Interior.ColorIndex = "your index colour code"
End If
End If
End If
Next c
Next iRow
[/VBA]
This is my first reply on this forum and i'm no vba expert, so please keep that in mind but i do hope this helps. Someone may have a better option for you.
Cheers Tammy
http://www.vbaexpress.com/forum/show...498#post196498
to see final result. thanks