Forum Discussion
Greeny95
Apr 24, 2022Copper Contributor
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 exam...
Greeny95
Apr 28, 2022Copper Contributor
Hi 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
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
HansVogelaar
Apr 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!