Hello. I have a workbook I created that tracks break times at my work. With formulas and private vba subs. We scan their badge and it puts the time in another column. In another column it adds 20 minutes, which is the time their break ends. In another column we scan their badge again and it inputs the time they came back. Then in another cell it subtracts the difference to give how much time they went over their break (column I). Format "0:05:45." So I have this VBA code that makes column K contain marlett checkboxes if there is any value in Column A. I use this as the "Late" column. If a person goes over 5 minutes I manually double click the cell. However I would like to automate this. How could I edit this code to double click the column K cell if the time in column I is over 5 minutes? I also would like to keep the rest of the code the same. Including the "offset line". Thank you to anyone willing to help!
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
With Target
If .Cells.Count = 1 And .Column = 11 And .EntireRow.Cells(1, 1) <> vbNullString Then
Cancel = True
If CStr(.Value) = vbNullString Then
.Value = "a"
Else
.Value = vbNullString
End If
.Offset(0, 1).Value = (.Value = "a")
.Font.Name = "Marlett"
.Font.Size = 14
End If
End With
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
With Target
If .Cells.Count = 1 And .Column = 11 And .EntireRow.Cells(1, 1) <> vbNullString Then
Cancel = True
If CStr(.Value) = vbNullString Then
.Value = "a"
Else
.Value = vbNullString
End If
.Offset(0, 1).Value = (.Value = "a")
.Font.Name = "Marlett"
.Font.Size = 14
End If
End With
End Sub