I’m using this code to achieve the following;
If the box is checked then a message box asks a question.
If the answer is YES then the current date and users name is entered into cells E3 and F3.
If the answer is NO then another message box appears with an instruction.
Click Okay and any contents in cells E3 and F3 are cleared.
However, I also want to remove the tick from the Check Box if the answer is NO.
How can this be achieved as well?
Sub CheckedByDate3csv()
Dim ans
If ActiveSheet.CheckBoxes(Application.Caller).Value = 1 Then
ans = MsgBox("QUESTION HERE?", vbYesNo)
If ans = vbYes Then
'Continue
'enters current date and users name into selected cells
Range("E3") = Format(Now(), "dd-mm-yy")
Range("F3") = Application.UserName
End If
If ans = vbNo Then
MsgBox ("INSTRUCTION HERE."), vbInformation
'clears current date and users name from selected cells
Range("E3").ClearContents
Range("F3").ClearContents
End If
End If
End Sub
Bookmarks