When the user tries to save the workbook, this tests for each used cell in column A on Sheet1 if there are values in columns CDE and G.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
With Sheets("Sheet1")
For Each Cell In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
If Application.CountA(.Rows(Cell.Row).Range("A1,C1:E1,G1")) < 5 Then
Application.Goto Cell.EntireRow
MsgBox "Missing entries in required columns A-C-D-E-G" & vbLf & _
"Please review and fill in the required columns", vbExclamation, _
"Save Workbook Canceled"
Cancel = True
Exit For
End If
Next Cell
End With
End Sub
EDIT: Paste the code in the ThisWorkbook code module.
Bookmarks