Olisthoughts
New Member
- Joined
- Apr 16, 2020
- Messages
- 33
- Office Version
- 365
- Platform
- Windows
Hi,
I've searched around and tried different scripts online but none worked in my case.
I'm making a break list for the team at my new job. The purpose is for employees to double-click on 1 cell, have the current time input, go on break, come back, double-click on a 2nd cell, have the current time input, then in a 3rd cell - the break duration appears. (That I can do)
But I want the cells in which the employees double-click for current time to be locked after they do so.
Whatever I tried other cells would get locked as well, or the whole sheet would get locked after entry in any cell. But I want only those specific cells to be locked.
In the screenshot, I want the "start time" and "actual return time" columns to be locked/protected after the employees put in their times, for each break.
Another function I can't figure out, is, I want a certain row to show how many agents are on break right now. I assume this would be calculated based on the cells with values of start break, but missing value in end break, but I just can't figure out how to do that.
Although I only need the lock function and agents on break right now function as necessities, it'd be useful if the color of the text from the agents on break field would change from green to yellow to red, along with the numbers. A max of 3 people are allowed on break so it'd be a nice feature for the employees to see 1 agent on break with green, if 2 are on break - yellow, if 3 - red, if more than 3 (not allowed) a darker red.
P.S. There are I believe 15 colleagues in my team, I've only put 4 of them for work.
Script I use for time on double click:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("c:u")) Is Nothing Then
Cancel = True
Target.Formula = Time
End If
End Sub
I've searched around and tried different scripts online but none worked in my case.
I'm making a break list for the team at my new job. The purpose is for employees to double-click on 1 cell, have the current time input, go on break, come back, double-click on a 2nd cell, have the current time input, then in a 3rd cell - the break duration appears. (That I can do)
But I want the cells in which the employees double-click for current time to be locked after they do so.
Whatever I tried other cells would get locked as well, or the whole sheet would get locked after entry in any cell. But I want only those specific cells to be locked.
In the screenshot, I want the "start time" and "actual return time" columns to be locked/protected after the employees put in their times, for each break.
Another function I can't figure out, is, I want a certain row to show how many agents are on break right now. I assume this would be calculated based on the cells with values of start break, but missing value in end break, but I just can't figure out how to do that.
Although I only need the lock function and agents on break right now function as necessities, it'd be useful if the color of the text from the agents on break field would change from green to yellow to red, along with the numbers. A max of 3 people are allowed on break so it'd be a nice feature for the employees to see 1 agent on break with green, if 2 are on break - yellow, if 3 - red, if more than 3 (not allowed) a darker red.
P.S. There are I believe 15 colleagues in my team, I've only put 4 of them for work.
Script I use for time on double click:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("c:u")) Is Nothing Then
Cancel = True
Target.Formula = Time
End If
End Sub