WArning message

  • Thread starter Thread starter NG_Leeds
  • Start date Start date
N

NG_Leeds

I want to put an error warning in to a s/s. I have a formula with a cel
AX=TX returning a true or false value, if the value is false, I wish t
have an error message occur to alert the user that the values are no
the same, either on occurrence or before saving ideally.
Is this possible?
If so how?
Thank you
 
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.

Option Explicit
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
'do nothing
Else
MsgBox "They don't match"
Cancel = True 'if you want to stop the save!
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top