ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is workbook beforeclose event the best place to do this? (https://www.excelbanter.com/excel-programming/374959-workbook-beforeclose-event-best-place-do.html)

Barb Reinhardt

Is workbook beforeclose event the best place to do this?
 
I want to check that a cell value = a predefined value and if it's not, don't
let the user close the workbook. The value needs to be 100%. Do you have
any suggestions on how to do this? This is what I have now:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Range("Reuse_Estimate_Total") < 1 Then
MsgBox ("The Reuse Estimate total is not equal to 100%" _
& "This will need to be updated before finishing")
End If
End Sub



[email protected]

Is workbook beforeclose event the best place to do this?
 
Hello,

I would suggest to take the BeforeSave event.

If any innocent person just tries to read the file he should be able to
get out with wrong values as far as he does not save anything...

Regards,
Bernd



All times are GMT +1. The time now is 05:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com