Add this code to the ThisWorkbook code module:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
With Worksheets("Sheet1")
If .Range("A1").Value < "" And .Range("B1").Value = "" Then
MsgBox "Mandatory cell not filled. No Save"
Cancel = True
End If
End With
End Sub
--
Rob van Gelder -
http://www.vangelder.co.nz/
"alche" wrote in message
...
Hello,
I searched the forums and were able to find similar things but cannot
make it work for the action that I need.
I am trying to make B1 a mandatory cell if user puts data in A1. So if
there is data in A1 and B1 is empty, an error message should be
displayed on Save. I am sure it is not very hard but I am not much of
an Excel programmer.
Any help will be greatly appreciated...
Thanks in advance...
--
alche
------------------------------------------------------------------------
alche's Profile: http://www.hightechtalks.com/m900
View this thread: http://www.hightechtalks.com/t2353270