Hi There. I have a code below that should be preventing excel from a user being able to save as without a certain range of cells filled out based on the parameters in my code. I thought it would work just fine, but in testing it will show the message box and then save anyways. Please help. Thanks
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim rngCell As Range
For Each rngCell In Range("J22:K51")
If rngCell.Value > "" And rngCell.Offset(0, -9).Value = "" Then
MsgBox "NEXT SVC DUE missing on Extinguisher Sheet", vbInformation, "Dignity Fire Protection"
Exit Sub
End If
Next
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim rngCell As Range
For Each rngCell In Range("J22:K51")
If rngCell.Value > "" And rngCell.Offset(0, -9).Value = "" Then
MsgBox "NEXT SVC DUE missing on Extinguisher Sheet", vbInformation, "Dignity Fire Protection"
Exit Sub
End If
Next
End Sub