ClimoC
Well-known Member
- Joined
- Aug 21, 2009
- Messages
- 584
Hey everybody
I have a large schedule where each row is sorted by the First date (already doing/done) but as there is a lot of data, we want to be able to colour the cell rows for each sequential date on the schedule.
So the first row starts at 6, the column with the date in question is "G", and we only want columns G:L coloured when the macro runs.
The idea is that the first (eg, 10) rows that have the date 28/08/09 will be coloured one way, and then the next 4 rows which are 29/08/09 will be another colour, next 15 that are 30/08/09 will be the first colour again (only wanting to work with two colours) - but only colouring the columns G:L in those particular rows.
I am working in Excel 2003.
I tried making this, but I don't think it's doing anything right, other than colouring the entire first row fuscia (so I can't even get the 'only colour columns G:L' bit right)
Please help
Cheers

I have a large schedule where each row is sorted by the First date (already doing/done) but as there is a lot of data, we want to be able to colour the cell rows for each sequential date on the schedule.
So the first row starts at 6, the column with the date in question is "G", and we only want columns G:L coloured when the macro runs.
The idea is that the first (eg, 10) rows that have the date 28/08/09 will be coloured one way, and then the next 4 rows which are 29/08/09 will be another colour, next 15 that are 30/08/09 will be the first colour again (only wanting to work with two colours) - but only colouring the columns G:L in those particular rows.
I am working in Excel 2003.
I tried making this, but I don't think it's doing anything right, other than colouring the entire first row fuscia (so I can't even get the 'only colour columns G:L' bit right)
Please help
Cheers
Code:
Sub colourdaterows()
Application.ScreenUpdating = False
Dim firstdate As Range, Cel As Object
Dim ary As Range
Set ary = Range("Schedule!G6:L500")
Set firstdate = Range("Schedule!G6")
For Each Cell In ary
If Cell.Value = firstdate Then
ActiveCell.EntireRow.Select
With Selection.Columns("G:L").Interior.ColorIndex = 24
End With
ElseIf Cell.Value = ActiveCell.Column + 1 Then
ActiveCell.EntireRow.Select
With Selection.Columns("G:L").Interior.ColorIndex = 0
End With
End If
Next
Application.ScreenUpdating = True
End Sub
