This works
Sub Raegan(): Dim SD As Date, Dn As Long, Df As Long
Dim r As Long, c As Long, F As Range, X As Range, n As Long
n = Columns.Find("*", , , , xlByColumns, xlPrevious).column
Set F = Range("D:D").Find("Enter Start Date")
If Not F Is Nothing Then
Do
r = F.Row: SD = F.Offset(0, 1): Dn = F.Offset(1, 1): Df = F.Offset(2, 1)
c = 7: Cells(r + 1, c).Resize(2, n).Interior.ColorIndex = xlNone
Do Until Cells(3, c) = SD: c = c + 1: Loop
Do
If c > n Then Exit Do
If Dn Then
Set X = Cells(r + 1, c).Resize(1, Dn): X.Interior.ColorIndex = 35
X.Value = Cells(r, 3)
X.Offset(1, Dn).Resize(1, Df).Interior.ColorIndex = 38
Else
Set X = Cells(r + 2, c).Resize(1, n - c + 1): X.Interior.ColorIndex = 38
End If
c = c + Dn + Df: Loop
Cells(r + 1, n + 1).Resize(2, Dn + Df).Interior.ColorIndex = xlNone
Set F = Range("D:D").FindNext(F)
Loop Until F Is Nothing Or F.Row <= r
End If
End Sub
Bookmarks