mandatory cell

A

adenbutter

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

Bernie Deitrick

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
 

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