Hi all.
Macro novice here - I’ve added a macro to a that requires all fields to be completed before it will allow the user to close the file. Unfortunately, this is a file that is continually added to, so I need additional code that will exclude blank rows:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim cell As Range
For Each cell In Range(Sheet1.Cells(2, 1), Sheet1.Cells(60, 3))
If isempty(cell.Value) = True Then
Cancel = True
MsgBox “Please fill in all fields.”, vbInformation, “Missing input”
End If
Next cell
ActiveWorkbook.Save
End Sub
Thanks in advance!
Macro novice here - I’ve added a macro to a that requires all fields to be completed before it will allow the user to close the file. Unfortunately, this is a file that is continually added to, so I need additional code that will exclude blank rows:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim cell As Range
For Each cell In Range(Sheet1.Cells(2, 1), Sheet1.Cells(60, 3))
If isempty(cell.Value) = True Then
Cancel = True
MsgBox “Please fill in all fields.”, vbInformation, “Missing input”
End If
Next cell
ActiveWorkbook.Save
End Sub
Thanks in advance!