![]() |
Don't save if cells are blank
Does anybody have an example of VBA code that looks at certain cells
when a person clicks Save or Save as and if the cell is blank it will display a message and not allow a save? Any help would be greatly appreciated. |
Don't save if cells are blank
Paste the code below in the ThisWorkbook code module. It will not allow a
save operation if Sheet1!A1 is blank. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Sheet1.Range("A1").Value = "" Then MsgBox "Sheet1!A1 is blank. Save operation not allowed." Cancel = True End If End Sub -- Hope that helps. Vergel Adriano "MasterChief" wrote: Does anybody have an example of VBA code that looks at certain cells when a person clicks Save or Save as and if the cell is blank it will display a message and not allow a save? Any help would be greatly appreciated. |
All times are GMT +1. The time now is 06:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com