Private Sub Worksheet_Change(ByVal Target As Range)'On Error GoTo ProcError
Application.ScreenUpdating = False
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'FRI End Time - 18 y/o check
If Target.Column = 5 Then
'If Under 18 and working past 23:00 Then ERROR
If Range("BJR" & Target.Row).Value = 0 Then
If Range("BKA" & Target.Row).Value = 1 Then
MsgBox "This staff member is under 18 and cannot work past 23:00!", vbExclamation, "ERROR"
End If
End If
'If FRI END - SAT START is less than 11h rest Then ERROR
If Range("BJT" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'SAT Start Time - 11H check - Against Previous Day
If Target.Column = 12 Then
'If Less than FRI END - SAT START is less than 11h rest Then ERROR
If Range("BJT" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
'SAT End Time - 18 y/o check
If Target.Column = 13 Then
'If Under 18 and working past 23:00 Then ERROR
If Range("BJR" & Target.Row).Value = 0 Then
If Range("BKB" & Target.Row).Value = 1 Then
MsgBox "This staff member is under 18 and cannot work past 23:00!", vbExclamation, "ERROR"
End If
End If
'If Less than SAT END - SUN START is less than 11h rest Then ERROR
If Range("BJU" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'SUN Start Time - 11H check - Against Previous Day
If Target.Column = 20 Then
'If Less than SAT END - SUN START is less than 11h rest Then ERROR
If Range("BJU" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
'SUN End Time - 18 y/o check
If Target.Column = 21 Then
'If Under 18 and working past 23:00 Then ERROR
If Range("BJR" & Target.Row).Value = 0 Then
If Range("BKC" & Target.Row).Value = 1 Then
MsgBox "This staff member is under 18 and cannot work past 23:00!", vbExclamation, "ERROR"
End If
End If
'If Less than SUN END - MON START is less than 11h rest Then ERROR
If Range("BJV" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'MON Start Time - 11H check - Against Previous Day
If Target.Column = 28 Then
'If Less than SUN END - MON START is less than 11h rest Then ERROR
If Range("BJV" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
'MON End Time - 18 y/o check
If Target.Column = 29 Then
'If Under 18 and working past 23:00 Then ERROR
If Range("BJR" & Target.Row).Value = 0 Then
If Range("BKD" & Target.Row).Value = 1 Then
MsgBox "This staff member is under 18 and cannot work past 23:00!", vbExclamation, "ERROR"
End If
End If
'If Less than MON END - TUE START is less than 11h rest Then ERROR
If Range("BJW" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'TUE Start Time - 11H check - Against Previous Day
If Target.Column = 36 Then
'If Less than MON END - TUE START is less than 11h rest Then ERROR
If Range("BJW" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
'TUE End Time - 18 y/o check
If Target.Column = 37 Then
'If Under 18 and working past 23:00 Then ERROR
If Range("BJR" & Target.Row).Value = 0 Then
If Range("BKE" & Target.Row).Value = 1 Then
MsgBox "This staff member is under 18 and cannot work past 23:00!", vbExclamation, "ERROR"
End If
End If
'If Less than TUE END - WED START is less than 11h rest Then ERROR
If Range("BJX" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'WED Start Time - 11H check - Against Previous Day
If Target.Column = 44 Then
'If Less than TUE END - WED START is less than 11h rest Then ERROR
If Range("BJX" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
'WED End Time - 18y/o check
If Target.Column = 45 Then
'If Under 18 and working past 23:00 Then ERROR
If Range("BJR" & Target.Row).Value = 0 Then
If Range("BKF" & Target.Row).Value = 1 Then
MsgBox "This staff member is under 18 and cannot work past 23:00!", vbExclamation, "ERROR"
End If
End If
'If Less than WED END - THU START is less than 11h rest Then ERROR
If Range("BJY" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'THU Start Time - 11H check - Against Previous Day
If Target.Column = 52 Then
'If Less than WED END - THU START is less than 11h rest Then ERROR
If Range("BJY" & Target.Row).Value = 0 Then
MsgBox "This staff member needs more rest!", vbExclamation, "ERROR"
End If
End If
'THU End Time - 18y/o check
If Target.Column = 53 Then
'If Under 18 and working past 23:00 Then ERROR
If Range("BJR" & Target.Row).Value = 0 Then
If Range("BKG" & Target.Row).Value = 1 Then
MsgBox "This staff member is under 18 and cannot work past 23:00!", vbExclamation, "ERROR"
End If
End If
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ProcError: MsgBox "ERROR!"
Application.ScreenUpdating = True
End Sub