+ Reply to Thread
Results 1 to 9 of 9

User Form Controls - Connect ComboBox Selection to Listbox

  1. #1
    Registered User
    Join Date
    03-20-2012
    Location
    LA
    MS-Off Ver
    Excel 2007
    Posts
    32

    User Form Controls - Connect ComboBox Selection to Listbox

    Looking for vba Code that allows the user to select an item from a comboBox that populates a listbox with three columns.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: User Form Controls - Connect ComboBox Selection to Listbox

    You need to provide more information about what 3 bits of data are needed in listbox.

    Please Login or Register  to view this content.
    This code will use the selected row to fill 3 items.

    If you are trying to populate the listbox with all matching records based on year then you will need to loop through the records and test year.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    03-20-2012
    Location
    LA
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: User Form Controls - Connect ComboBox Selection to Listbox

    Andy,

    I understand I should have clarified that based on the "Year" selected I would like the list box to display columns "C", "E", and "O".

    thanks

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: User Form Controls - Connect ComboBox Selection to Listbox

    So you just need to alter the Offset positions in the example provided

  5. #5
    Registered User
    Join Date
    03-20-2012
    Location
    LA
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: User Form Controls - Connect ComboBox Selection to Listbox

    Andy,

    I notice when I select a year from the drop down, in the list box the header is below the item did I miss something else?

  6. #6
    Registered User
    Join Date
    03-20-2012
    Location
    LA
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: User Form Controls - Connect ComboBox Selection to Listbox

    This how is looks

    ENC Test.png

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: User Form Controls - Connect ComboBox Selection to Listbox

    The additem method create a new line within the listbox. The .List() property allows you to fill the specified column of an existing line.
    I think you need to change the 2 additems to List

  8. #8
    Registered User
    Join Date
    03-20-2012
    Location
    LA
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: User Form Controls - Connect ComboBox Selection to Listbox

    I notice the add items fill the first column. I'm work on that this afternoon

    thanks

  9. #9
    Registered User
    Join Date
    03-20-2012
    Location
    LA
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: User Form Controls - Connect ComboBox Selection to Listbox

    Andy I modified the code which looks correct need a little help connecting the drop down box to the list box. I added an additional worksheet called reports

    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)

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