Stop user from saving workbook unless cell is filled in

C

Churley

I created an account form in Excel that is filled in by others when they want
a new account to be set up.
There is one cell in particular that they have to fill in, but very often do
not. I was hoping there was something in Excel that would stop them from
saving the spreadsheet unless this cell is filled in.
Any help would be appreciated.

Thanks so much.
 
M

Mike H

Hi,

Alt +F11 to open VB editor, double click 'This Workbook' and paste this in
on the right. Change the cell to the one you want and tidy up the message

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not IsDate(Sheets("Sheet1").Range("A1").Value) Then
MsgBox "You must fill in cell xxxxxx"
Cancel = True
End If
End Sub

Mike
 
C

Churley

Mike H,

Thanks so much. This worked fine.


Mike H said:
Hi,

Alt +F11 to open VB editor, double click 'This Workbook' and paste this in
on the right. Change the cell to the one you want and tidy up the message

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not IsDate(Sheets("Sheet1").Range("A1").Value) Then
MsgBox "You must fill in cell xxxxxx"
Cancel = True
End If
End Sub

Mike
 

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

Top