Try this code in the workbook_beforeclose module.
Keep in mind that users have the option to NOT enable macros when prompted and can thus defeat any VBA code.
Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim msg As String
msg = "Warning: cells C2 and D3:E12 are missing data"
msg = msg & vbLf & vbLf & "Please complete the missing entries"
With Sheet1
If .Range("C2") = vbNullString Or WorksheetFunction.CountBlank(.Range("D3:E12")) > 0 Then
MsgBox (msg), vbCritical
Cancel = True
End If
Application.Goto reference:=Sheet1.Range("C2"), scroll:=True
End With
End Sub
Bookmarks