MSGBOX called by if statement

  • Hi there,


    My problem is this; I am trying to put together an email order form for a product range. There are certain product dependencies giving me problems, for example:
    - if you order 2 x Product A, you will need 2 x Product C (but not product D)


    - if you order 2 x Product B, you will need 2 x Product D (but not Product C), etc.


    What I would like to do is have an alert popup if the user orders both Product C and Product D but the only place I can think to put the data validation is already being used as a list.


    My apologies if this doesn't make sense but I am getting ready to put keyboard through my monitor.


    (Please be gentle, I know little to no VB)


    Thanks,


    Ben

  • Re: MSGBOX called by if statement


    Can you attach a small example of what you mean Ben.


    You can attach small workbooks up to 45kb to your replies if you use the full reply option.

  • Re: MSGBOX called by if statement


    I would normally suggest a Warning Message generated by Data Validation, but your list is generated by DV. Maybe Conditional Formatting could be used to unhide a message in a cell ie have your warning message in a cell, Font White, if Product A & B are choseb, use Conditional Formatting to change the Font to Black. Otherwise you will need VBA on a Sheet_Change or Calculate

  • Re: MSGBOX called by if statement


    I have done this via roys suggestion. Without use of vb, it is impossible to have an actual msgbox used, however, with a few formulas (which I left easy to see, but can be formatted). I left the cells in yellow so you will know which ones i have put formulas in. With a true formula, a couple if formulas, and a cheat concectonate formula (which could also be nested in an if formula should it be required in that cell).


    To see it work:
    add any of product a
    add 2 or more of product d


    I hope this helps you.

  • Re: MSGBOX called by if statement


    Thanks very much for the help.


    I finally got something working using the worksheet_change event (I didn't realise that there were tutorials on the site)


    Now all I have to do is finish it...


    Ben

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!