View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default Is it possible to have different pop up messages to appear

Try this John,

Right click on the sheet tab and pick View code.
Paste code.

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Range("A1"), Target) Is Nothing Then
If Target.Value = 1 Then
MsgBox "Value " & Target.Value & _
" in A1 is correct", vbInformation
Else
MsgBox "Value " & Target.Value & _
" in A1 is incorrect", vbExclamation
End If
End If

End Sub

It checks that the change cell is A1. If so it checks the value is 1 and
displays an appropriate message box.

Cheers
Andy


John Davies wrote:
Hi Andy

Yes I could use conditional formatting to change text colour, therefore
could you please show me what worksheet event code I should use to show the
different messages as I do not any experience of coding
Thanks
John

"Andy Pope" wrote:


Hi,

You could use worksheet event code to display a message box. But message
boxes do not allow formatting of the message. For that you would need to
use a userform.

Would the choice of red for correct not confuse the user? Red normally
indicates a warning, bad or incorrect status.

Can you not use conditional formatting to change the cells pattern colour?

Cheers
Andy

John Davies wrote:

Is it possible to have different messages pop up, e.g. if cell a1 = 1, a
message will pop p showing "Correct" with red bold text, if cell a1 = 2,
message popus will show "Incorrect" with blue bold text etc.

Thanks in advance of any help.
John