Results 1 to 2 of 2

Thread: Invalid Data in Validation Cells
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Mar 2013
    Location
    Manchester, UK
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Invalid Data in Validation Cells

    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.

  2. #2
    MrExcel MVP AlphaFrog's Avatar
    Join Date
    Sep 2009
    Posts
    16,102
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    7 Thread(s)

    Default Re: Invalid Data in Validation Cells

    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:
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Address(0, 0) = "A1" Then
            Range("A2:A3").ClearContents
        ElseIf Target.Address(0, 0) = "A2" Then
            Range("A3").ClearContents
        End If
    End Sub
    Last edited by AlphaFrog; Sep 8th, 2019 at 06:35 PM.
    Paste your Excel data to the forum...
    MrExcel HTML Maker or Excel Jeanie

    How to post your vba code
    [CODE]your VBA code here[/CODE]
    The # button in the forum's editor will apply CODE tags around your selected text.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •