+ Reply to Thread
Results 1 to 10 of 10

Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection

  1. #1
    Registered User
    Join Date
    04-16-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection

    Hello,

    I have 3 columns A,B,C and 3 combobox.

    Data from Column A gets populated on 1st combobox, column B in 2nd and column C in 3rd.

    Below is the code I came across that achieves this -

    Please Login or Register  to view this content.
    I'm looking for a code that can auto populate 3rd combobox based on what is selected in the 2nd combobox.

    Have attached sample sheet
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    04-16-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Re: Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection

    Any assistance will be helpful

  3. #3
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection

    Unless I'm missing something this code is doing exactly what you're asking.
    If I select AA I get A1 & A2 in second combobox, Then select A1 in second combobox result in combobox1third combo) = 01A.
    Code can be improved for performance on larger datasets but where is the problem ??

  4. #4
    Registered User
    Join Date
    04-16-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Re: Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection

    Hello bakerman2,

    I should have been more specific.

    Just as you stated, currently I have to select data from all 3 comboboxes.

    Since the 3rd combobox reflects only single data, I want the 3rd combobox to automatically reflect the data in it when data from 1st two comboboxes are selected.

    So, if I select AA from 1st combobox and A1 from 2nd, I want the 3rd combobox to show 01A automatically without even clicking on it.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection

    In Secondary_Change.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    04-16-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Re: Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection

    Exactly what I required... Thanks

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection

    You're welcome but one remark.
    You say combo3 only reflects single data, wouldn't it be better then to just perform search for value of combo2 in column 2 and present matching value of column 3 instead of looping and building array using redim preserve ?

  8. #8
    Registered User
    Join Date
    04-16-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Re: Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection

    Hello bakerman2,

    I'm not a coder.

    My requirement was to create a userform that can open specific files.

    Column A contains Main File names, Column B contains file names associated with main files from column A, and Column C contains path of files from Column B.

    The code which I found (including yours) populates all 3 combobox and when the command button is pressed opens the file as per the path from Column C.

    I have a final thought after you provided your code (Hope my explanation makes sense)

    As you stated macro should present the data from Column C. This data can be presented in a textbox or label or combobox.

    Currently I press Tab 4 times to reach the command button. Can you do something so that I press Tab 3 times to reach the command button. First 2 Tabs would be to select data from 1st two combobox and the 3rd Tab should highlight the command button and when pressed enter should open the required files.

    I humbly request you to go through the code from my original attachment and add code for my above explanation and simplify the code wherever required.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection

    See if this works for you.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    04-16-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    57

    Re: Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection

    Perfect...Many Thanks

+ 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 Have Text Boxes Auto Populate Based on Combobox Selection & overwrite existing da
    By Rajesh shishodia in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2015, 02:06 AM
  2. Populate Combobox based on Selection in another Combobox
    By DomSza in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-30-2015, 08:19 AM
  3. [SOLVED] How do I populate a specific range in one ComboBox based of selection of another ComboBox?
    By gmr4evr1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-04-2015, 04:32 PM
  4. [SOLVED] Userform Have Text Boxes Auto Populate Based on Combobox Selection
    By strother1990 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-02-2015, 04:30 PM
  5. Replies: 4
    Last Post: 03-02-2014, 03:33 AM
  6. Userform Combobox to populate based on selection in another combobox
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2014, 03:34 PM
  7. Auto populate Textboxes fro Combobox selection
    By Cuba64 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-03-2014, 05:52 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