Input data

  • Thread starter Thread starter Carl Johnson
  • Start date Start date
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.
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top