+ Reply to Thread
Results 1 to 3 of 3

populate user form combobox based on dynamic range

  1. #1
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2013
    Posts
    116

    populate user form combobox based on dynamic range

    Hi,

    I have a combobox that populates based on a dynamic range in column A. I populate the combobox using the following concept:
    1st, I created a named range and, using the offset command, set the reference to increase when values are added:
    Please Login or Register  to view this content.
    2nd, I populate the combobox when a userform initializes using something like:
    Please Login or Register  to view this content.
    Now, this works just fine, but I want to complicate things a bit:
    In column A I have certain rows of data that start and end with an asterisk. These rows are related to information from a different combobox. The following depicts what I have in Column A:

    *17-PS-1*
    TEST1
    TEST2
    TEST4
    *17-PS-2*
    TEST1
    TEST2
    *17-PS-3*
    TEST1
    TEST2
    TEST4
    *17-PS-4*
    TEST

    So imagine combobox1 lists 17-PS-1, 17-PS-2, 17-PS-3, 17-PS-4 (without the asterisks) and combobox2 lists the above.

    What I want is, depending on what is selected in combobox1, I want the dynamic list to look for that value in the combobox2 range, and list every row until the next asterisk title is reached or the end of the rows of data is reached.

    Example:
    Column A lists:
    *17-PS-1*
    TEST1
    TEST2
    TEST4
    *17-PS-2*
    TEST1
    TEST2


    17-PS-2 is selected in combobox1, then combobox2 should list TEST1, TEST2.

    Then, due to other parts of the userform, Column A becomes:
    *17-PS-1*
    TEST1
    TEST2
    TEST4
    *17-PS-2*
    TEST1
    TEST2
    new1
    new2

    I want combobox2 to now list TEST1, TEST2, new1 and new2.

    Let me know if this is unclear and I can go into more detail. Thanks!

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: populate user form combobox based on dynamic range

    certain rows of data that start and end with an asterisk. These rows are related to information from a different combobox
    Not really sure what this means.

    See attachment.
    David
    (*) Reputation points appreciated.

  3. #3
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2013
    Posts
    116

    Re: populate user form combobox based on dynamic range

    Thanks for the help!

    This nearly does what I need it to. What you have provided allows me to add additional sub-levels (those filling combobox2) but it doesn't allow me to add new asterisk levels (those that populate combobox1). What I meant by the text that you hi-lighted, is that the "Structure" is saved in another column without the asterisks.

    I was able to come up with a solution that works, although the code may be rather cringe-worthy.

    This is what works for me:
    the sub-structure data appears in column AJ. Stc_box is synonymous with your combobox1, while Sst_box is synonymous with your combobox2

    Please Login or Register  to view this content.
    I have another column that lists out the structures (those with asterisks) that updates once a new structure is added. So, the comboboxes that I have both dynamically update the structure (based on a named range with the offset function) and the substructure (updated via the code above).

+ 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] Populate user form based on combobox choices
    By zardof in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-20-2012, 11:08 AM
  2. Calling a user form initialize sub when entering the form to populate combobox...
    By regupnorth in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-02-2012, 07:24 AM
  3. transferring combobox value from one user form to populate combobox on another
    By smartphreak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2010, 10:12 PM
  4. Populate a combobox in a userform with a dynamic range.
    By BigBas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-23-2007, 01:12 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