To remove the Monday errors, change this formula in B8 from: =WEEKDAY(B7) to =WEEKDAY(B7;1), and format cell B8 as a number, not as a date (be careful to the red number in formula: the results of the formula means: 1:sunday, 2 monday, etc; if instead of 1 you choose 2 in the formula, 1 is monday, 2 is for tuesday, etc; if choose 3, then 0 is for monday, 1-tuesday, etc)
An easy way to increase with 2 days the second lesson, is to add the red lines in your code: (which will overwrite the values in these cells)
For intStudentSOWCounter = 5 To intTotalNumber
Range("A" & intStudentSOWCounter).Value = Sheets("sow").Range("A" & intStudentSOWCounter).Value
If IsEmpty(Range("A" & intStudentSOWCounter).Value) = True Then
'MsgBox "HOLIDAY"
strRange = "A" & intStudentSOWCounter & ":" & "F" & intStudentSOWCounter
Range(strRange).Select
With Selection.Interior
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.249977111117893
End With
End If
Range("B" & intStudentSOWCounter).Value = Sheets("sow").Range("B" & intStudentSOWCounter).Value
Range("C" & intStudentSOWCounter).Value = Sheets("sow").Range("C" & intStudentSOWCounter).Value
Range("D" & intStudentSOWCounter).Value = Sheets("sow").Range("D" & intStudentSOWCounter).Value
Range("E" & intStudentSOWCounter).Value = Sheets("sow").Range("F" & intStudentSOWCounter).Value
Range("F" & intStudentSOWCounter).Value = Sheets("sow").Range("K" & intStudentSOWCounter).Value
Next
For intStudentSOWCounter = 5 To intTotalNumber Step 2
Range("C" & intStudentSOWCounter + 1).Value = Range("C" & intStudentSOWCounter).Value + 2
Next
The macro will run until row 61 to 65, which has a different input dates in sow
To overcome this, if you do not want to change format in data source, (sow), break the range:
For intStudentSOWCounter = 5 To 60 Step 2
Range("C" & intStudentSOWCounter + 1).Value = Range("C" & intStudentSOWCounter).Value + 2
Next
For intStudentSOWCounter = 66 To intTotalNumber Step 2
Range("C" & intStudentSOWCounter + 1).Value = Range("C" & intStudentSOWCounter).Value + 2
Next
For rows 61 to 65, you need another approach. It's important to know if this type of data in sow sheet will stay on these lines, or can vary, in this case, this approach will not work for those lines
|