I think I'd just change your formula. I'm gonna use A1 and B1 for my two cells:
=if(a1=b1,"","Warning--values don't match!")
Format in nice big red bold letters. Place it close to where the users input
data, I bet it would work ok.
If you really wanted a macro, you could have a workbook event fire before the
user saves the workbook.
rightclick on the excel icon (to the left of File|Edit|View on the worksheet
menubar) and select view code.
Paste this in the code window.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim myCell As Range
Set myCell = Me.Worksheets("sheet1").Range("a1")
If myCell = True Then
MsgBox "They don't match"
Cancel = True 'if you want to stop the save!
"NG_Leeds <" wrote:
> I want to put an error warning in to a s/s. I have a formula with a cell
> AX=TX returning a true or false value, if the value is false, I wish to
> have an error message occur to alert the user that the values are not
> the same, either on occurrence or before saving ideally.
> Is this possible?
> If so how?
> Thank you.
> Message posted from http://www.ExcelForum.com/