Prevent user from closing excel unless two cells are equal

Niven

New Member
Joined
Aug 23, 2011
Messages
45
Hi,

I am creating a timesheet for users to enter their daily working hours as well as an allocation of their total hours worked. The allocation is very important as they work in different projects.

Is there a way I can prevent the workbook from closing and an error message appearing to let them know that their total hours need to equal the hours allocated?

Thanks.
Niven
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi,Another dilemma. I have created macros on the timesheet to create a pdf and also to e-mail the doc. Is there a way to include the same message to prevent the user from creating the pdf or e-mailing the doc if the values are not equal as per the previous code? Here is what I have for the pdf and e-mail codes.Sub Create_PDF()'' Create_PDF Macro' Creates a PDF version of the current worksheet'' ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "D:\Users\niven\Desktop\Weekly Timesheet.pdf", Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ TrueEnd SubSub Send_via_email()'' Send_via_email Macro'' Application.Dialogs(xlDialogSendMail).ShowEnd Sub
 
Upvote 0

Forum statistics

Threads
1,216,111
Messages
6,128,898
Members
449,477
Latest member
panjongshing

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top