mattygriff
Programmer
I have a workbook which must not be closed if a specific cell (named CERTIFICATE_NO) is empty. Currently, I have this code.....
.....which tests the cell and, if it is empty, places the focus on it. The problem is that it doesn't stop the closure process which I need to do.
Can anyone help?
Thanks in advance.
Code:
Private Sub workbook_onclose(cancel As Boolean)
If Sheet3.Range("CERTIFICATE_NO").Value = "" Then
MsgBox "Please enter a Certificate Number."
' Sheet3.Unprotect
Sheet3.Activate
Sheet3.Range("CERTIFICATE_NO").Activate
' Sheet3.Protect
End If
End Sub
Can anyone help?
Thanks in advance.