I have used this code to show a message box if a certain employee has less than 12 hours rest which works if I enter the values in manually, but column G is a result of a formula from E and F. I am not sure how to set it up so that when I enter the times in E and F, column G will change automatically and the box will flag up.
Thanks for any help![]()
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Target.Parent.Range("G5:G1000")
If Target.Count > 1 Then Exit Sub
If Intersect(Target, rng) Is Nothing Then Exit Sub
Application.EnableEvents = False
Select Case Target.Value
Case Is < 12
MsgBox (Range("E1") + " has less than 12 hours rest"), vbQuestion + vbOKCancel, "Exceedance"
Case Else
Target.Offset(, -1).Value = Target.Offset(, -1).Value + Target.Value
End Select
Application.EnableEvents = True
End Sub
Bookmarks