Hi All,
I have some code that I run on the Before Close event, which does various things, including setting the file name of an output file created by the code. The file name is dependent on certain data entry in one of the worksheets. I need some code that will stop the Close event in case the fields are not complete. What I have is:
However, the Exit Sub commands doesn't do what I want it to do, which is stop the entire Close event from happening. What am I missing...?
I have some code that I run on the Before Close event, which does various things, including setting the file name of an output file created by the code. The file name is dependent on certain data entry in one of the worksheets. I need some code that will stop the Close event in case the fields are not complete. What I have is:
VBA Code:
If Sheets("Instructions").Range("C1") = "" Or Sheets("Instructions").Range("C2") = "" _
Or Sheets("Instructions").Range("C3") = "" Or Sheets("Instructions").Range("C4") = "" Then
MsgBox "Please complete required data (Date, Name, LDV Serial Number and Threshold Power", vbOKOnly
Exit Sub
End If