To Output Data sheet code module.
Private Sub Worksheet_Activate()
Dim r As Range, LastR As Range, s As Long, i As Long, n As Long, f As Long, flg As Boolean
Application.ScreenUpdating = False
Columns("b:p").Clear
For Each r In Sheets("input data").Columns("b").SpecialCells(2)
If r.Interior.ColorIndex <> xlNone Then
flg = Not flg
Set LastR = Cells(Rows.Count, IIf(flg, "b", "j")).End(xlUp)(4)
r.Resize(, 7).Copy LastR
With LastR.Resize(, 7)
s = Asc(Trim$(Split(.Cells(1, 2), "to")(0)))
f = Asc(Trim$(Split(.Cells(1, 2), "to")(1)))
.Cells(1).Value = Join(Array(.Cells(1), .Cells(1, 6)), " - ")
.Rows(2).Resize(, 3) = [{"Seq","Day","Task"}]
For i = 0 To f - s
.Cells(i * 2 + 3, 1) = Chr(s + i)
Next
With .Resize((i + 1) * 2 - 1)
.Borders.Weight = 2
.HorizontalAlignment = xlCenter
Application.DisplayAlerts = False
.Rows(1).Merge
For i = 2 To .Rows.Count
.Cells(i, 3).Resize(, .Columns.Count - 3).Merge
Next
End With
End With
End If
Next
[b1:p2].Delete xlShiftUp: Rows.AutoFit
Application.ScreenUpdating = True
End Sub
Bookmarks