Hi all,

I have a worksheet that requires specific cells to have data input in by the user before the workbook is closed. The problem is my users still manage NOT to complete all the required cells!!

What I'm looking for is some way of stopping them from closing/saving the workbook until the conditions are met.

I've come up with the following code so far but I'm looking for the code that will stop the workbook from being closed.

Any suggestions??


[VBA]
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Sheets("Daily Centre Inputs").Range("D6,F6,C8:C18,I6:I18,A22:K22,A29,A36,H36").Value = "" Then
MsgBox "Incomplete fields. Please check your data ensuring any required cells are complete otherwise you will not be able to close or save the workbook"

'What do I need to code here to stop workbook from being closed????
End If
End Sub
[/VBA]

Cheers