Invalid Data in Validation Cells

SteveBC

New Member
Joined
Mar 8, 2013
Messages
21
I have created a product order form on Excel.
In cell A1 I can select a product from a validation list.
in cell A2 I can select from a choice of upholstery for that specific product from another validation list.
in cell A3 I can select from a choice of weights for that specific product from a further list.
Upholstery and weights can differ according to which product is selected.

Whilst I have written a macro to clear all data between orders I am worried that the person who places the orders might not clear the data and then select a different product which would potentially leave the previous upholstery and weight in the cells below creating an ‘illegal’ combination and an invalid order.
i discovered circle invalid data but it appears that is not an automatic function and it would need to be selected each time. Is there any way such an illegal combination would be automatically highlighted?

Any help appreciated.
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,136
Use a Worksheet_Change event macro to automatically clear the dependent dropdowns when a parent dropdown changes.

To install this code in the Worksheet's code module:

  • Right-click on the sheet tab
  • Select View Code from the pop-up context menu
  • Paste the code below in the sheet's code module

Code:
[COLOR=darkblue]Private[/COLOR] [COLOR=darkblue]Sub[/COLOR] Worksheet_Change([COLOR=darkblue]ByVal[/COLOR] Target [COLOR=darkblue]As[/COLOR] Range)
    [COLOR=darkblue]If[/COLOR] Target.Address(0, 0) = "A1" [COLOR=darkblue]Then[/COLOR]
        Range("A2:A3").ClearContents
    [COLOR=darkblue]ElseIf[/COLOR] Target.Address(0, 0) = "A2" [COLOR=darkblue]Then[/COLOR]
        Range("A3").ClearContents
    [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
End [COLOR=darkblue]Sub[/COLOR]
 
Last edited:

Forum statistics

Threads
1,078,273
Messages
5,339,190
Members
399,288
Latest member
ossa

Some videos you may like

This Week's Hot Topics

Top