Validation - Ensure Cell values match
Try:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Worksheets("Sheet1")
If Range("C1") < Range("D5") Then
MsgBox "Error - checksum mismatch" '<=== change to required message
Cancel = True '<=== workbook remains open
End If
End With
End Sub
To insert code:
Alt+F11 to open Visual Basic Editor (VBE)
right click on "Thisworkbook" in VBS project window
Click "View Code"
Copy & paste above code.
HTH
"bluesifi" wrote:
Hi
I have a spreadsheet, and need to ensure that the value in a number of cells
are the same.
Example
Cell C1 shows the total number of open Problem. Table Two has All Open
Problems by Age with a check Sum in Cell D5. The Value in Cell C1 & D5
should be the same. I would like a warning message to be displayed before
you save or exit the sheet, if the two values are not the same
Is this possible
|