ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   mandatory cell (https://www.excelbanter.com/excel-discussion-misc-queries/173250-mandatory-cell.html)

[email protected]

mandatory cell
 
i want my colleagues to mandatory fill in a cell before saving. is
this possible? (sorry for my poor english)
thanks
bta

Bernie Deitrick

mandatory cell
 
bta,

Copy the code below, and paste it into the codemodule of the ThisWorkbook object. See

http://www.mvps.org/dmcritchie/excel/event.htm

if you are not familiar with event coding.

This code will require cell A1 of Sheet1 be filled in before the file will be saved.

HTH,
Bernie
MS Excel MVP


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Worksheets("Sheet1").Range("A1").Value = "" Then
MsgBox "Fill in cell A1 on Sheet1 !!!!"
Cancel = True
MsgBox "File is not saved yet!"
End If
End Sub

wrote in message
...
i want my colleagues to mandatory fill in a cell before saving. is
this possible? (sorry for my poor english)
thanks
bta





All times are GMT +1. The time now is 07:56 PM.

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