+ Reply to Thread
Results 1 to 4 of 4

Populate combobox dependent on contents of previous combobox

  1. #1
    Registered User
    Join Date
    09-16-2014
    Location
    Weymouth, Dorset
    MS-Off Ver
    2010
    Posts
    4

    Populate combobox dependent on contents of previous combobox

    Hi

    I am (or thought I was!) a reasonably competent Excel user, but I am having trouble with comboboxes on a form I'm creating, which will be used for data input by end users. Previously, I would have used Access for this purpose but as my current employers don't use Access, I am having to make the form in Excel. The form is 99% complete and usable as it is, but I would like to make one final update for ease of use.

    Basically, I'm trying to find a way of replicating Excel's "indirect" function in a combobox, so the selections from a second combobox are dependent on the input in the first one.

    To explain, the user selects an item from the first box - let's say the first box contains the options "Boys Toys", "Girls Toys" (not my choice - I think anyone can play with any toy), "Games" and "Radio Control". The second combobox contains the options "Barbie", "Horrible Science", "1:24 Scale Ferrari", "Monster High", "Scooter" and "Playmobil". Some of those toys fit in more than one category (eg Scooter could be "Girls Toys" or "Boys Toys", but some are specific - eg "1:24 Scale Ferrari" would only be in "Radio Control" (okay, we could argue the point about "Boys Toys" but that's not really relevant!) and "Barbie" would be in "Girls Toys". I have named ranges for each of the categories. My aim is to only allow the relevant selections in the second combobox dependent on the first selection, which I thought would be done using a Case statement, but either I'm wrong, or my syntax is wrong.

    Any help would be very much appreciated, an apologies if this has already been answered previously - I did try to search the forums but couldn't find anything matching.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Populate combobox dependent on contents of previous combobox

    Your suppositions are sound. You should be able to fill your comboboxes or ListBoxes using the defined named ranges.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

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

    Re: Populate combobox dependent on contents of previous combobox

    What have you tried so far?

    Also, where are your comboboxes located?
    If posting code please use code tags, see here.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Populate combobox dependent on contents of previous combobox

    A Google search on "excel vba userform dependent combo boxes" does bring up many approaches and tutorials on these concepts. I always like it when I see Contextures in the results:
    http://www.contextures.com/exceluser...omboboxes.html

+ 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. [SOLVED] Userform combobox to populate RowSource for new values in combobox
    By Stratfordoaks in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-17-2013, 01:18 PM
  2. [SOLVED] Filter Combobox base on selection from previous combobox
    By ciapul12 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-18-2013, 07:25 PM
  3. [SOLVED] Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox select
    By MileHigh_PhD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 04:50 PM
  4. Way to populate combobox rowsource based on previous combobox value
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-08-2012, 12:50 AM
  5. Replies: 2
    Last Post: 09-14-2009, 08:34 AM

Tags for this Thread

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