+ Reply to Thread
Results 1 to 11 of 11

Data validation list that is reduced based on a previous cell selection

  1. #1
    Registered User
    Join Date
    06-14-2014
    Location
    Reading, England
    MS-Off Ver
    Excel 2013 - Windows 7
    Posts
    18

    Data validation list that is reduced based on a previous cell selection

    Hi, any help would be appreciated! I have attached a spreadsheet in case anyone wanted to take a look at it.

    On Sheet2 in column H I have the name of suppliers. Column E features the product they sell. However the same supplier (eg Amazon) will feature many times in column H, showing the different products they sell on new rows. The suppliers are not in any specific order in Column H, and some suppliers will eventually feature up to 50 times over 1000+ rows.

    On Sheet3 I have a purchase order form. At the top of the purchase order the user selects a supplier (such as "Amazon"). After they select a supplier there are 10 rows where they can then select products they require from a drop down.

    I would like these 10 rows to only allow a user to select products sold by the supplier they chose at the top (ie not 1000+ options from ALL suppliers!). Can this be done? I would happily insert VBA if that was the solution, but don't know how! Thanks if you can help, I have been reading everywhere for 2.5 days but can't see a solution anywhere.
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Data validation list that is reduced based on a previous cell selection

    Please update your profile as necessary to properly reflect the exact version(s) of Excel your question relates to. Members tailor answers based on your Excel version.

  3. #3
    Registered User
    Join Date
    05-29-2005
    MS-Off Ver
    2013
    Posts
    36

    Re: Data validation list that is reduced based on a previous cell selection

    Have a look at the attached file and see if it helps... If you change the supplier in the sheet '3 Order Form' the items should also change now


    ]DT Template.xlsm
    Last edited by ascool_asice; 12-18-2014 at 11:06 AM.

  4. #4
    Registered User
    Join Date
    06-14-2014
    Location
    Reading, England
    MS-Off Ver
    Excel 2013 - Windows 7
    Posts
    18

    Re: Data validation list that is reduced based on a previous cell selection

    Thanks Davesexcel; I have added those details as requested.

    ascool_asice; I appreciate you looking at this a huge amount. I downloaded your file (with macros enabled) but when you change the supplier it only ever offers item 8 and item 9. I appreciate you looking at it so much, do you think I am doing something wrong at my end?

  5. #5
    Registered User
    Join Date
    05-29-2005
    MS-Off Ver
    2013
    Posts
    36

    Re: Data validation list that is reduced based on a previous cell selection

    Hi,

    Not sure why its not working on your PC/laptop.. you might want to check your trust center settings

    File->Options->Trust Center->Trust Center Settings

    I have my settings to enable all macro's...

    you can see the file in action https://www.dropbox.com/s/cw0ic1l630...30-01.flv?dl=0

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Data validation list that is reduced based on a previous cell selection

    This code goes in the combobox,
    when you make a selection in the supplier combobox the code activates. and creates a data validation list starting at M1.
    It then sets the data validation in the form.

    I forgot to mention that the worksheet has to be unprotected in order to work.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by davesexcel; 12-19-2014 at 05:25 AM.

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Data validation list that is reduced based on a previous cell selection

    I like ascool_asice approach as well,

    I have amended his code so there would be no reason to unhide the "Patch" Sheet, and also the list will only be the correct size.
    Please Login or Register  to view this content.
    Last edited by davesexcel; 12-19-2014 at 05:26 AM.

  8. #8
    Registered User
    Join Date
    06-14-2014
    Location
    Reading, England
    MS-Off Ver
    Excel 2013 - Windows 7
    Posts
    18

    Re: Data validation list that is reduced based on a previous cell selection

    Gents, that is phenomenal. I learn so much browsing these boards! Thank you for your help.

    There is one bit of code that generates an error which may have a simple solution... but I just don't know enough! It is bold below:

    Please Login or Register  to view this content.
    If happens if you select a supplier from the list but they have no "Regular Items" for sale. A "runtime error 1004 - No cells were found" message comes up upon selecting the supplier. The issue is that sometimes a user of this sheet may want to select a supplier from the list, but only to add "one-off items" on the order form... so they will not need to use the regular items section of the form. Is it possible to get rid of that problem so that either no debug message comes up?

    Either which way, your work has left me even more aware of how little I know! Thanks so much.

  9. #9
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Data validation list that is reduced based on a previous cell selection

    Well what's the error?
    Did it work with the sample I provided?
    What is different from my sample workbook and the actual workbook?

  10. #10
    Registered User
    Join Date
    06-14-2014
    Location
    Reading, England
    MS-Off Ver
    Excel 2013 - Windows 7
    Posts
    18

    Re: Data validation list that is reduced based on a previous cell selection

    Hi Dave,

    I'm away from Excel as I'm going away now for a few days. I don't want to trouble you further but the problem is as follows. When I downloaded your sample file (thanks) if I ever selected a supplier who had no "regular items" listed it generated an error message as described in my previous post. I saw that you added some code in a message AFTER the sample was uploaded, so I tried replacing the original code and I also put that in as a new sub. It generated an error message on the line:

    Please Login or Register  to view this content.
    I know the problem will be that the code you gave me AFTER your file upload hasn't be attributed to the right place BY ME... but I can't work it out and I'm way out of my depth!

  11. #11
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Data validation list that is reduced based on a previous cell selection

    The last code I supplied was an amended code for ascool_asice example.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Updating cells based on selection from drop down list data validation
    By excelstun in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-18-2016, 05:11 PM
  2. Auto-Generate List from reference cells based on data validation list selection
    By BoundCustomDesign in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-13-2014, 11:06 AM
  3. [SOLVED] Updating cells based on selection from drop down list data validation
    By jingles9 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-24-2013, 02:57 PM
  4. Pull Data from Multiple Columns Based On Data Validation List Selection
    By CHRISOK in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2013, 11:41 PM
  5. Replies: 3
    Last Post: 09-29-2011, 02:21 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1