Input data

C

Carl Johnson

I have a spreadsheet that will require the end user to enter data in certain
cells. How can I setup the spreadsheet so that the user cannot close the
sheet until they have entered the data? Thank you in advance.
 
R

Ron de Bruin

You can use this in the BeforeClose event in the thisworkbook module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Application.WorksheetFunction.CountA(Sheets("Sheet1") _
.Range("A1:a10")) < 10 Then
MsgBox "You must fill in all the cells"
Cancel = True
End If
End Sub
 
C

Carl Johnson

Thanks Ron worked great.
Ron de Bruin said:
You can use this in the BeforeClose event in the thisworkbook module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Application.WorksheetFunction.CountA(Sheets("Sheet1") _
.Range("A1:a10")) < 10 Then
MsgBox "You must fill in all the cells"
Cancel = True
End If
End Sub
 
Top