Hi - the below code does as expected for rows 3 to 21. But for some reason, consistently ignores row 2.
Even if I change the range the range to;
row 2 is still ignored. The value in "U" is the same as all other ranges.
Full code;
Thanks in advqance
Even if I change the range the range to;
VBA Code:
For i = 1 to 21
row 2 is still ignored. The value in "U" is the same as all other ranges.
Full code;
VBA Code:
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Rota" And ws.Name <> "Key" And ws.Name <> "Template" Then
For i = 2 To 21
If ws.Range("U" & i).Value = "E" Then
ws.Range("B" & i).Resize(, 18).Value = ""
ws.Range("D" & i).Value = "Break"
ws.Range("N" & i).Value = "Break"
ws.Range("H" & i).Resize(, 2).Value = "Lunch"
ws.Range("R" & i).Resize(, 2).Value = "Unstaffed"
End If
If ws.Range("U" & i).Value = "L" Then
ws.Range("B" & i).Resize(, 18).Value = ""
ws.Range("G" & i).Value = "Break"
ws.Range("Q" & i).Value = "Break"
ws.Range("B" & i).Resize(, 2).Value = "Unstaffed"
ws.Range("L" & i).Resize(, 2).Value = "Lunch"
End If
If ws.Range("U" & i).Value = "MS" Then
ws.Range("B" & i).Resize(, 18).Value = ""
ws.Range("F" & i).Value = "Break"
ws.Range("O" & i).Value = "Break"
ws.Range("B" & i).Value = "Unstaffed"
ws.Range("S" & i).Value = "Unstaffed"
ws.Range("J" & i).Resize(, 2).Value = "Lunch"
End If
Next i
End If
Next ws
Thanks in advqance