ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Stop user from saving workbook unless cell is filled in (https://www.excelbanter.com/excel-discussion-misc-queries/206610-stop-user-saving-workbook-unless-cell-filled.html)

Churley

Stop user from saving workbook unless cell is filled in
 
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.

Mike H

Stop user from saving workbook unless cell is filled in
 
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

"Churley" wrote:

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.


Churley

Stop user from saving workbook unless cell is filled in
 
Mike H,

Thanks so much. This worked fine.


"Mike H" wrote:

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

"Churley" wrote:

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.


Mike H

Stop user from saving workbook unless cell is filled in
 
Glad I could help

"Churley" wrote:

Mike H,

Thanks so much. This worked fine.


"Mike H" wrote:

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

"Churley" wrote:

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.



All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com