Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ScreenUpdating = False
Dim rng As Range, rng2 As Range
For Each rng In Sheets("Sheet1").Range("B1:B17")
If rng <> "" Then
If rng.Offset(0, 1) = "" Then
MsgBox ("Cell " & rng.Offset(0, 1).Address(0, 0) & " has no data. Please complete.")
rng.Offset(0, 1).Select
Cancel = True
Exit Sub
End If
For Each rng2 In Range("E" & rng.Row & ":F" & rng.Row)
If rng2 = "" Then
MsgBox ("Cell " & rng2.Address(0, 0) & " has no data. Please complete.")
rng2.Select
Cancel = True
Exit Sub
End If
Next rng2
End If
Next rng
Application.ScreenUpdating = True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.ScreenUpdating = False
Dim rng As Range, rng2 As Range
For Each rng In Sheets("Sheet1").Range("B1:B17")
If rng <> "" Then
If rng.Offset(0, 1) = "" Then
MsgBox ("Cell " & rng.Offset(0, 1).Address(0, 0) & " has no data. Please complete.")
rng.Offset(0, 1).Select
Cancel = True
Exit Sub
End If
For Each rng2 In Range("E" & rng.Row & ":F" & rng.Row)
If rng2 = "" Then
MsgBox ("Cell " & rng2.Address(0, 0) & " has no data. Please complete.")
rng2.Select
Cancel = True
Exit Sub
End If
Next rng2
End If
Next rng
Application.ScreenUpdating = True
End Sub