I added the Cancel = True to cancel the save in case you wanted to
prevent the save.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
On Error GoTo ErrorHandler
If Sheets(1).Range("A1") <> "" And Sheets(1).Range("B1") = "" Then
Err.Raise vbObjectError + 1, , _
"Value not in B1 when there is a Value in A1"
End If
Exit Sub
ErrorHandler:
Response = MsgBox("Enter a Value into Cell B1", vbOKOnly, "Your
Program Name")
Cancel = True
End Sub
Bookmarks