mandatory cell

  • Thread starter Thread starter adenbutter
  • Start date Start date
A

adenbutter

i want my colleagues to mandatory fill in a cell before saving. is
this possible? (sorry for my poor english)
thanks
bta
 
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
 
Back
Top