Hello
When the user closes the workbook, I want a message to appear if the worksheet has not been protected. I was using the code below but it closes the workbook without giving the user the opportunity to protect and save. Is there a way to stop the macro from closing the workbook and allow the user to make changes?
When the user closes the workbook, I want a message to appear if the worksheet has not been protected. I was using the code below but it closes the workbook without giving the user the opportunity to protect and save. Is there a way to stop the macro from closing the workbook and allow the user to make changes?
Code:
Private Sub Workbook_Beforeclose(Cancel As Boolean)
If Range(“C2”).locked=false then
Msgbox(“Protect Wkbk and save”)
End if
End Sub