ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is it possible to have different pop up messages to appear (https://www.excelbanter.com/excel-programming/381124-possible-have-different-pop-up-messages-appear.html)

John Davies

Is it possible to have different pop up messages to appear
 
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

Andy Pope

Is it possible to have different pop up messages to appear
 
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


John Davies

Is it possible to have different pop up messages to appear
 
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



Corey

Is it possible to have different pop up messages to appear
 
You could use the msgbox display types to have a different look:


Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value = 1 Then MsgBox "Incorrect", vbExclamation ' Warning
Look
Range("A1").Activate
If Range("A1").Value = 2 Then MsgBox "Correct", vbInformation ' Question
Mark
Range("A1").Activate
End Sub



Corey....
"John Davies" wrote in message
...
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




Andy Pope

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




All times are GMT +1. The time now is 05:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com