Forum Discussion
VBA code message box
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...
- Greeny95Apr 28, 2022Copper ContributorHi Hans,
I found time again to work on my excel. Busy times...
Your VBA code works perfect. Wauw! Thanks a lot. I've two more little questions. I run also another VBA code in the same sheet. I copied your code on the same page. Now I get the message: compileerfout: onduidelijke naam gedetectreerd: Worksheet_Change. The two codes start with the same name. I tried to change one of them by adding a "2" but then, the code with the changed name don't work anymore.
And another small thing: I like to add one more "and" condition. Row D are dates. So when the 3 previous conditions are true AND it's a sunday then I need the warning to pop up. I hoped it was something like 'WEEKDAG("D")=1 ' but it wasn't that easy. I hope you can help me one more time! Thanks. Manu- HansVogelaarApr 28, 2022MVP
Use
=NOT(AND(OR($A1="Boston",$A1="Antwerp",$A1="Berlin"),OR($B1="red",$B1="blue",$B1="green"),$C1="Yes",WEEKDAY($D1)=1)
In Dutch:
=NIET(EN(OF($A1="Boston";$A1="Antwerp";$A1="Berlin");OF($B1="red";$B1="blue";$B1="green");$C1="Yes";WEEKDAG($D1)=1)
- Greeny95Apr 29, 2022Copper ContributorI knew the formula. But I meant the VBA code...
- HansVogelaarApr 28, 2022MVP
There can only be one Worksheet_Change event procedure per worksheet. so you have to copy the code of one of the procedures (without the lines Private Sub ... and End Sub) into the other one, then remove the first one entirely.
- Greeny95Apr 29, 2022Copper ContributorAh ok!