Forum Discussion
VBA code message box
Hi all.
I need some brains here.
I need a VBA code for this action:
I want a simple message box to appear (a warning) depending on the choices made by the person who uses this worksheet.
For example: when the result in cell A1 = "Boston" OR "Antwerp" OR "Berlin" AND the result in B1= "red" OR "blue" OR "green" AND the result in C1= "Yes" then i need a message box (warning) that says : "your choice is not possible!"
Of course this must work also for all the rows in this worksheet...
For me too complicated. I understand the VBA code but writing it is not my cup of tea!
Can someone help me with this?
Greeny95
13 Replies
- MRAfshar3000Copper Contributortype MsgBox "the massage", vbOKOnly , "subject"
No VBA needed.
Select columns A to C. The active cell in the selection should be in row 1.
On the Data tab of the ribbon, click Data Validation.
Select Custom from the Allow drop-down.
Enter the following in the Formula box:
=NOT(AND(OR($A1="Boston",$A1="Antwerp",$A1="Berlin"),OR($B1="red",$B1="blue",$B1="green"),$C1="Yes"))
Activate the Error Alert tab.
Enter an appropriate message.
Click OK.
- Greeny95Copper Contributor
Hi Hans (per toeval Nederlands-sprekend?)
Thanks for your answer!
I tried your solution. And it worked but: in one of the columns I use already data validation with a list. When I use your solution I can't use the dropdown menu anymore in that column.
That's why I think I need a macro. Unless there is another solution?
Kind regads
Manu (Greeny95)
Ik ben Nederlands, trouwens...