Hello. I would like some help in revising the below code. It is used to verify data before the document is saved. If data is incorrect, the user is given the choice to continue saving the file or they will be returned to the document to correct the invalid data I would like the "Save" to be changed to "Save As" so that the user can rename the document instead of automatically overwriting the existing one. Thank you.
![]()
Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim ans As Variant If ActiveSheet.Range("A1").Value = True And ActiveSheet.Range("B2") = "" Then ans = MsgBox("A number is required when the role 'xxx' is checked. If number was provided, please enter 'TBD' or 'N/A' as appropriate." _ & vbNewLine & vbNewLine & "Do you want to save the file anyway?", _ vbQuestion + vbYesNo, "OPTION") If ans = vbNo Then Cancel = True End If End If End Sub
Bookmarks