NOT ALLOWING A WORKBOOK TO CLOSE


Posted by STEVE on February 28, 2001 9:27 AM

How do I make a workbook not able to close if lets say cell A1 has a 1 in it.Then I want to display a message saying form incomplete.

thanks steve



Posted by David Hawley on February 28, 2001 1:26 PM


Hi Steve

Right click on the sheet picture with the X on it, top left next to file. Paste in this code and change to suit.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Sheets("Sheet1").Cells(1, 1) = 1 Then
MsgBox "Form incomplete", vbCritical
Cancel = True
End If
End Sub


Dave

OzGrid Business Applications