+ Reply to Thread
Results 1 to 5 of 5

3 dynamic comboboxes, 2nd dependent on 1st and 3rd dependant on 2nd in VBA

  1. #1
    Registered User
    Join Date
    02-21-2010
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2007
    Posts
    11

    3 dynamic comboboxes, 2nd dependent on 1st and 3rd dependant on 2nd in VBA

    Hi everybody. This will be my first post here, I hope to participate and learn as much as I can.
    I have a combobox in a userform called ProductSupplierloc which populates products from the 3rd column of DataValidation sheet. I am trying to link a second combobox which will populate the product description of the product chosen in first combo box. Than I need a third combobox which will populate the suppliers that provide this product description.
    What I have can be seen by clicking on enter data on data gathering allocation sheet.

    The data for the product descriptions are in DataValidation sheet on row 2003 column A. And the data for the Suppliers which offer the product descriptions are on DataValidation sheet on row 4 column Q. I have attached the relevant example.

    I had done it via data validation earlier but than my boss wanted the whole thing to be controlled from VBA. I am quite new to VBA and I am trying to learn as fast as I can. I searched in forums found 3 threads but could not implement it. Can someone kindly help me on this issue?
    Thanks.
    Attached Files Attached Files
    Last edited by begilhang; 03-09-2010 at 02:54 PM. Reason: Better explaining the title

  2. #2
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: 3 dynamic comboboxes, 2nd dependent on 1st and 3rd dependant on 2nd in VBA

    Hi begilhang

    I have put some code in the change event of two of your combo boxes which give you your desired result.

    Please test let me know if it is ok.

    Thanks
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    02-21-2010
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: 3 dynamic comboboxes, 2nd dependent on 1st and 3rd dependant on 2nd in VBA

    Thank you very much your answer almost works. But so far I see two problems. First one is when orange is chosen as product name, and red orange is chosen as product description, 2 suppliers appear. 1st one is correct that is "Agrofrut" but the second one is Gronsaks which does not offer this item.
    Second problem is when apple is chosen as product name and fuji apples are chosen as product description chenzke supplier appears twice in the drop box. You can simulate it in the excel sheet. Seems like a loop issue. Trying to figure out the problem but I guess you can manage it much faster than me. If you can help me on this it will be great if not you have already given me a good lead. Thank you very much.

  4. #4
    Registered User
    Join Date
    02-21-2010
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: 3 dynamic comboboxes, 2nd dependent on 1st and 3rd dependant on 2nd in VBA

    Dear excelxx

    I would like to thank you once again. I have solved the two small bugs in one of the Private subs and now it seems to work flawlessly. I am posting the code that i modified below so people who may have similar problems can get help from it.
    Thanks again.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-04-2010
    Location
    Hertfordshire, England
    MS-Off Ver
    Office 2007 (home) Office 365 (work)
    Posts
    134

    Re: 3 dynamic comboboxes, 2nd dependent on 1st and 3rd dependant on 2nd in VBA

    Hi begilhang

    Just seeing your post, I'm glad that the bulk of the code worked.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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