Hi,I have a worksheet where I am comparing two columns of data and if they don't match then it does not allow the user to close the file. This is the code I have and it works well. However I also have a button which takes the user to an outlook message for them to e-mail the current worksheet. Is there a way to link the two, so that if the user clicks the button it also won't allow him to e-mail and will give him the same error message? I have included below the macro for the e-mail button.Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim blnCancel As Boolean Dim rngCell1 As Excel.Range, rngCell2 As Excel.Range blnCancel = Not Sheets("Weekly Timesheet").Range("C44").Value If blnCancel Then Call MsgBox(Prompt:="Have ALL hours worked been allocated correctly?", Title:="Cannot close workbook", Buttons:=vbExclamation + vbOKOnly) End If Cancel = blnCancelEnd SubSub Send_via_email()'' Send_via_email Macro'' Application.Dialogs(xlDialogSendMail).ShowEnd Sub
Last edited: