How could I edit this marlett checkbox VBA code to automatically check them based on another cell's value?

Indominus

Board Regular
Joined
Jul 11, 2020
Messages
160
Office Version
  1. 2016
Platform
  1. Windows
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
 
By the way, when I test I just change the value of I 0:5:0 or whatever, get immediate fire of my code.
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top