+ Reply to Thread
Results 1 to 9 of 9

Populating combobox based upon cells having any value

  1. #1
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Populating combobox based upon cells having any value

    I have the following code which set sets the row range based upon Combobox1.Value
    Please Login or Register  to view this content.

    What I need is some finishing code which will populate Combobox2 based upon information from the row combobox 1 has taken it to.

    Search Column Q for value:

    If no value and column E = "A", "B", "C" then populate comboxbox2 with "Host"
    If no value and column E = "D", "E", "F" then populate combobox2 with "Agent"
    If value then do not populate combobox2

    Search Column R for Value
    If no value and column E = "A", "B", "C" then populate combobox2 with "Buyer"
    If no value and column E = "D", "E", "F" then populate combobox2 with "Engineer"
    If value then do not populate combobox2

    Search Column s for Value
    If no value and column E = "A", "B", "C" then populate combobox2 with "Person"
    If no value and column E = "D" then populate combobox2 with "Artist"
    If value then or no value and Column E = "E", "F" do not populate combobox2

    Search Column T for Value
    If no value and column E = "A", "B", "C" then populate combobox2 with "Example"
    If no value and column E = "D", then populate combobox2 with "Worker"
    If value then or no value and Column E = "E", "F" do not populate combobox2

    Thanks for any help in advance.

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Populating combobox based upon cells having any value

    Hello jaredmccullough,

    I believe this will work (not tested) :

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Populating combobox based upon cells having any value

    Quote Originally Posted by GC Excel View Post
    Hello jaredmccullough,
    Thanks GC because this code is dependent on combobox1 value how would you suggest having it activate? Is there a way to have it run when the user clcks onto combobox2 and if so is there a way to make the display of the combobox say like "Select here" until the combobox is chosen?

  4. #4
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Populating combobox based upon cells having any value

    Difficult to answer without seeing the rest of your code.
    You could use an event triggered when the combobox1 is changed :

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Populating combobox based upon cells having any value

    GC Worked perfect (2) questions though:

    1.) Is there a way to have initial text in the combobox to guide the user like "Select Here" or something
    2.) Now if I wanted to use a combination of a commandbutton and textbox to return a value to the cell chosen in combobox2 (i.e. combobox1 picks the row and combobox2 is essentially setting the cell as it is using columns). How would one approach that?

  6. #6
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Populating combobox based upon cells having any value

    GC Worked perfect (2) questions though:

    1.) Is there a way to have initial text in the combobox to guide the user like "Select Here" or something
    2.) Now if I wanted to use a combination of a commandbutton and textbox to return a value to the cell chosen in combobox2 (i.e. combobox1 picks the row and combobox2 is essentially setting the cell as it is using columns). How would one approach that?

  7. #7
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Populating combobox based upon cells having any value

    1) you could put a label on your form next to/above combobox2 and make it visible when combobox1 is changed.
    Please Login or Register  to view this content.
    2)Difficule again to answer without seeing your workbook but if I understand well, on your button:
    Please Login or Register  to view this content.
    Note: You would have to define rng as a module variable.

  8. #8
    Forum Contributor
    Join Date
    04-23-2012
    Location
    Bradford PA
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Populating combobox based upon cells having any value

    Quote Originally Posted by GC Excel View Post
    1) you could put a label on your form next to/above combobox2 and make it visible when combobox1 is changed.
    Please Login or Register  to view this content.
    2)Difficule again to answer without seeing your workbook but if I understand well, on your button:
    Please Login or Register  to view this content.
    Note: You would have to define rng as a module variable.
    Quote Originally Posted by GC Excel View Post
    1) you could put a label on your form next to/above combobox2 and make it visible when combobox1 is changed.
    Please Login or Register  to view this content.
    2)Difficule again to answer without seeing your workbook but if I understand well, on your button:
    Please Login or Register  to view this content.
    Note: You would have to define rng as a module variable.
    GC,

    I did not perform enough testing on the previous code: Essentially you will see the code was modified with actual terms and the columns were adjusted one over. The problem is it is not populating the combobox with all values just the last one from the code. (See example of "insurance" if column R and S were empty it should provide both values in the combobox.

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Populating combobox based upon cells having any value

    If you want to populate the combobox will all possible values, then instead of having :

    Please Login or Register  to view this content.
    Use this :


    Please Login or Register  to view this content.

+ 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. Populating Combobox based on Combobox selection from EXCEL worksheet
    By JChaney17 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-04-2014, 08:14 AM
  2. Populating textboxes based on ComboBox value.....
    By harish_gr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-24-2013, 09:05 AM
  3. Removing Duplicates from ComboBox and Populating one combobox based on another
    By kbmtech in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2010, 11:17 PM
  4. Populating the list in a combobox based off the value chosen in another combobox
    By Mervil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2010, 11:50 AM
  5. Need help populating second combobox based on value in first
    By Patrick3001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-22-2009, 12:31 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