Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have this code:
------------- Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Const rngWeek As String = "nrmWWeek" Const rngTotal As String = "gTotal" Const rngLast As String = "lastDay" On Error GoTo stoppit Application.EnableEvents = False If Me.Range(rngLast).Value < 0 Then If Me.Range(rngTotal).Value < Me.Range(rngWeek).Value Then Response = MsgBox("The weekly total in cell G88 should match the value in cell B1" _ , vbOKOnly, "Total Hours Error") Cancel = True End If End If stoppit: Application.EnableEvents = True End Sub ---------- What I want to accomplish is to display a message when the user clicks on the "save" button when the numbers in 2 cells dont match. But for some reason, the above code continues to save the workbook even the values dont match. Please help. Thank you, Sharon |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I change a Worksheet_change event to a beforesave event? | Excel Programming | |||
Need help with BeforeSave event | Excel Programming | |||
Code Problem in BeforeSave Event | Excel Programming | |||
BeforeSave event | Excel Discussion (Misc queries) | |||
BeforeSave event | Excel Programming |