The amended code that I posted is triggered when the initial is selected in the Data validation list. It colours each cell in the row of that day.I used xlToRight because your blocks did not all contain the same number of columns. If you have a fixed number of columns in each day then the code could be amended easily. The only necessity is an empty column between days and it will work without changing on each day that you add.
Code to colour the initials plus next four columns
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Dim lColour As Long
Dim Rw As Long
Dim Col As Long
If Not Intersect(Target, _
ActiveSheet.UsedRange.SpecialCells(xlCellTypeAllValidation)) Is Nothing Then
Rw = Target.Row
Col = Target.Column
Select Case Target.Value
Case Cells(4, 28).Value: lColour = 1
Case Cells(5, 28).Value: lColour = 3
Case Cells(6, 28).Value: lColour = 4
Case Cells(7, 28).Value: lColour = 7
Case Cells(8, 28).Value: lColour = 5
Case Cells(9, 28).Value: lColour = 46
Case Else: Exit Sub
End Select
'colour 5 cells including Target with initials in
Range(Cells(Rw, Col), Cells(Rw, Col + 4)).Font.ColorIndex = lColour
End If
End Sub
What is it not doing that you outlined in the first post? You don't need loops hich will only slow down the code.
Bookmarks