Hello everyone,
I am trying to disable saving until all mandatory cells are populated.
a) Tested ctrl+s and clicking on the save button without results.
b) Created a Private Sub that's triggering the error "Compile error: Expected End Sub" and it's highlighting Sub MandatoryFields()
No idea what's wrong, not sure if it's a contradicting code that's making this happen. Tried several fixes without success... Please help!
Sub MandatoryFields()
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Sheets("Termination Report").Range("J6").Value = "" Then
MsgBox "LEASE TYPE (J6( must be entered"
Cancel = True
Exit Sub
End If
If Sheets("Termination Report").Range("J7").Value = "" Then
MsgBox "CLIENT'S PROVINCE (J7) must be entered"
Cancel = True
Exit Sub
End If
If Sheets("Termination Report").Range("J15").Value = "" Then
MsgBox "UNIT RETENTION DETAILS (J15) must be entered"
Cancel = True
Exit Sub
End If
If Sheets("Termination Report").Range("D18").Value = "" Then
MsgBox "DISPOSAL TYPE (D18) must be entered"
Cancel = True
Exit Sub
End If
If Sheets("Termination Report").Range("J19").Value = "" Then
MsgBox "BUYER'S PROVINCE (J19) must be entered"
Cancel = True
Exit Sub
End If
If Sheets("Termination Report").Range("D24").Value = "" Then
MsgBox "EQUITY/LOSS INSTRUCTIONS (D24) must be entered"
Cancel = True
Exit Sub
End If
If Sheets("Termination Report").Range("E28").Value = "" Then
MsgBox "TERMINATION VALUE (E28) must be entered"
Cancel = True
Exit Sub
End If
End Sub
Thank you in advance for your help!
Bookmarks