winstela
New Member
- Joined
- Feb 24, 2019
- Messages
- 28
- Office Version
- 2016
- Platform
- Windows
Good Evening All
Can anyone help me with below worksheet change event as its not working. I want to be able to check when a cell is change if the row total in the range is greater than 60 then show msgbox and then clear the contents.
so if the cell that was changed was P11 and the sum total for O11 to V11 was then greater than 60 clear contents for range O11 to V11
Thanks for looking
W
Can anyone help me with below worksheet change event as its not working. I want to be able to check when a cell is change if the row total in the range is greater than 60 then show msgbox and then clear the contents.
so if the cell that was changed was P11 and the sum total for O11 to V11 was then greater than 60 clear contents for range O11 to V11
Thanks for looking
W
VBA Code:
If Not Intersect(Target, Range("O9:V24")) Is Nothing Then
For Each celV In Target
myRowV = celV.Row
Application.EnableEvents = False
If Application.WorksheetFunction.Sum(.Range("o" & myRowV & ":V" & myRowV)) > 60 Then
MsgBox "you cannot exceed 60 mins"
Range("o" & myRowV & ":V" & myRowV).ClearContents
Application.EnableEvents = True
End If
Next celV
End If