JJanower
10-21-2011, 08:29 AM
'Recounting the Rows and Columns
RowCount = Cells(1, 1).CurrentRegion.Rows.Count
ColumnCount = Cells(1, 1).CurrentRegion.Columns.Count
'Create Weekly schedule Report
For k = 1 To RowCount
Worksheets("Weekly schedule Report").Cells(k + 1, 1) = Cells(k, 3)
Worksheets("Weekly schedule Report").Cells(k + 1, 2) = Cells(k, 2)
Worksheets("Weekly schedule Report").Cells(k + 1, 3) = Cells(k, 4)
Worksheets("Weekly schedule Report").Cells(k + 1, 4) = Cells(k, 1)
Set rng = Range(Cells(k, 1), Cells(k, 1).End(xlToRight))
NumberBreaks = WorksheetFunction.CountIf(rng, "Short Break")
Shiftstart = WorksheetFunction.Min(rng)
ShiftEnd = Cells(k, 6)
Worksheets("Weekly schedule Report").Cells(k + 1, 5) = Shiftstart
For l = 7 To ColumnCount
If NumberBreaks = 2 Then
If Cells(k, l) = "Short Break" Then
If Worksheets("Weekly schedule Report").Cells(k + 1, 6) = "" Then
Worksheets("Weekly schedule Report").Cells(k + 1, 6) = Cells(k, l - 2)
Else
Worksheets("Weekly schedule Report").Cells(k + 1, 8) = Cells(k, l - 2)
End If
End If
ElseIf NumberBreaks = 1 Then
Worksheets("Weekly schedule Report").Cells(k + 1, 6) = Cells(k, l - 2)
End If
If Cells(k, l) = "Lunch" Then
Worksheets("Weekly schedule Report").Cells(k + 1, 7) = Cells(k, l - 2)
End If
Next l
For z = 7 To ColumnCount Step 3
If Cells(k, z - 1) > ShiftEnd Then
ShiftEnd = Cells(k, z - 1)
End If
Worksheets("Weekly schedule Report").Cells(k + 1, 9) = ShiftEnd
Next z
Next k
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.