+ Reply to Thread
Results 1 to 9 of 9

Help with Comboboxes/Dependent Comboboxes

  1. #1
    Registered User
    Join Date
    04-08-2019
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    24

    Help with Comboboxes/Dependent Comboboxes

    I am trying to teach myself comboboxes and dependent comboboxes. I am having a hard time understanding this example code and I was hoping someone could help me understand what is going on here. My goal is to eventually impliment this in a userform that I am trying to create. My user experience is pretty low, I am a material scientist trying to piece this together and understand.

    Here is the site that I am working from.

    https://www.contextures.com/exceluse...omboboxes.html

    I think I just don't understand the "With" Code.

    Coming at it from a more straight forward angle. I have my userform. I have my companies "divisions" in a combobox. Based on what I choose there I want that to dictate my next combobox that pulls up customers for that division. To take it to the next step. Each customer will have a couple of employees that we interact with so I'd like to have my next combobox that lists "Contact" to be dependant on what "customer" is chosen.

    I thought I could start with this tutorial and learn it enough to rewrite it to suit my needs.

    Any help, insight or direction is appreciated. Thanks!

    Edit: I forgot to add. I am struggling with this code because I can make the top combobox show my divisions, I can my the second combobox show the customer but it also grabs from the C column which I don't want. I don't understand what part of the code controls that. It seems that second combobox shows 2 variables.
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Help with Comboboxes/Dependent Comboboxes

    Could you attach a workbook with your data?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    04-08-2019
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    24

    Re: Help with Comboboxes/Dependent Comboboxes

    Here is my file. I would like to not have that customer list tab there. If at all possible I would like to have the comboboxes referencing a different workbook. Basically I am running quotes for 3 different divisions and we have specific lists of customer for each division. And then there are multiple people from each customer that may request a quote from us. That is the order this is trying to go in. I am also planning on setting up the new customer button to be able to add anew customer and contact info to that customer/Contact data base.
    Attached Files Attached Files

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Help with Comboboxes/Dependent Comboboxes

    Hi there,

    Here's a quick fix which might help you to get things moving in the right direction:

    Delete the "commented out" line:

    Please Login or Register  to view this content.
    Add the highlighted line:

    Please Login or Register  to view this content.
    Delete the entire routine:

    Please Login or Register  to view this content.

    Regarding:


    If at all possible I would like to have the comboboxes referencing a different workbook

    I think you'll probably have to "pull in" the data from the other workbook using a link or similar, but it might be possible to find an alternative solution if this is not acceptable.


    Hope this helps - feel free to shout if you need further explanations or assistance.

    Regards,

    Greg M
    Attached Files Attached Files
    Last edited by Greg M; 08-14-2020 at 09:59 AM. Reason: Comment added

  5. #5
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Help with Comboboxes/Dependent Comboboxes

    Alternative, using tables - the headers populate the 'company' combo and filter the relative sector.
    Was putting together a more subtle approach however stuck for time for a day or two.
    Any queries post back on this site.
    torachan.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    04-08-2019
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    24

    Re: Help with Comboboxes/Dependent Comboboxes

    i love this place. I keep getting stuck on stuff and everyone is so quick to jump in and help.

    This is working out really well greg, thank you! I will try to make some adjustments and get it pulling from a separate workbook but this really helped me get moving forward again.

  7. #7
    Registered User
    Join Date
    04-08-2019
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    24

    Re: Help with Comboboxes/Dependent Comboboxes

    Greg, Can you help me understand the code you added?

    Customer.List = Worksheets("Customer List").Range("B2:B39").Columns(Company.ListIndex + 1).Value

    What I think I understand.

    Customer.List - Is this referring to the Customer drop down list (Customer ComboBox?) then telling it where to look (Look in the "Customer List" Worksheet). and then pull information from Cell B2 through B39 (The list of acoustic customers). and then the next line is telling it to look in the columns for the specific company that matches the company chosen in the company list (Company ComboBox.) and choose that column to show for the drop down in the customers list.

    Am I understanding that correctly?

    How do the specific values for the cells B2 through B39 become important? Why not B5 through B885? I ask that question because since the customer list for each company is variable, why does dictating that specific range become important?

    Can I rinse and repeat this code to make a combobox for the ATTN drop down? I feel like it will start to get hairy when I have to list every single customer. Especially when I have duplicates between companies like 3M for Industry and 3M for medical. they have their own sets of contacts that would go into the ATTN field.

    Let me know if that makes sense. Thanks!

  8. #8
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: Help with Comboboxes/Dependent Comboboxes

    You want a single page customer pseudo 'database'.
    Using primary and secondary key fields (name & sector) you can then combine all the company details (address, email, phone, contact etc., etc,.
    torachan.

  9. #9
    Registered User
    Join Date
    04-08-2019
    Location
    Minneapolis, MN
    MS-Off Ver
    2016
    Posts
    24

    Re: Help with Comboboxes/Dependent Comboboxes

    You are right. We have a list of customers for each of our 3 divisions and each of those customers has a list of contacts that we work with. This is our quote tracking spreadsheet. An engineering would open this up and fill out the fields in the userform and then the next open quote number would be assigned to them. then when clicking "ok" this would make a new project folder in the correct company and customer location, then open our quoting sheet and automatically save a copy of it in this project folder as well as autofill some key inputs in the quote sheet. These cells that autofill from the information in that first userform are then getting the rest of the quote information to autofill in the final offer sheet. Meaning the address, email and phone number. So the customer name and the contact name. So Customer = 3M and contact = Erik Johnson. The code takes those and puts them into the correct cells in the offer sheet and then the cells that have the address and payment terms are based off the customer cell and the phone number and email are based off the contact cell.

+ 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. 3 dependent comboboxes
    By Bandito1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-06-2019, 10:09 PM
  2. Dependent Comboboxes
    By gandreso in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-27-2016, 10:46 AM
  3. Replies: 3
    Last Post: 02-18-2015, 02:02 PM
  4. Help! Entire Row Hidden - w/Two ComboBoxes - Doesn't Hide the ComboBoxes
    By ocnmel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-06-2015, 09:27 AM
  5. Two comboBoxes dependent on one another (userform)
    By fionamb83 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2013, 05:18 AM
  6. [SOLVED] Dependent comboboxes
    By ObiWanBaloney in forum Excel General
    Replies: 6
    Last Post: 06-04-2012, 08:40 PM
  7. dependent comboboxes
    By humboldtguy in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-14-2010, 10:40 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