+ Reply to Thread
Results 1 to 16 of 16

populate listbox with multiple columns

  1. #1
    Registered User
    Join Date
    06-18-2014
    Location
    philippines
    MS-Off Ver
    2007
    Posts
    11

    populate listbox with multiple columns

    good day,

    I am here again seeking help. Hoping for consideration..

    I have this code that populates listbox, but it only has 1 column, I am hoping to find answer in adding column from selected data column.

    Please Login or Register  to view this content.
    Thank you...

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: populate listbox with multiple columns

    Add red code. Update sheet name and column to suit. You must also define the list box properties to have two columns.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    06-18-2014
    Location
    philippines
    MS-Off Ver
    2007
    Posts
    11

    Re: populate listbox with multiple columns

    Untitled.jpg

    would there be a way to add another column just by changing the arrowed number from code?

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: populate listbox with multiple columns

    Your code has no comments for what it is doing or why it is doing it and your post didn't explain it. If you explain what you're doing and attach a sample file I can dig into it.

  5. #5
    Registered User
    Join Date
    06-18-2014
    Location
    philippines
    MS-Off Ver
    2007
    Posts
    11

    Re: populate listbox with multiple columns

    the code is from the attached excel. It was originally for populating combobox. And I modified it trying to apply in a listbox.. but my problem now is to display multiple columns in the listbox from identified columns from the worksheet data. and my worksheet data has about 18 columns. I only wish to populated selected worksheet data columns to be displayed in the listbox...

    I don't fully know each code lines purpose.. from the original code, I just modify some figures.
    Attached Files Attached Files

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

    Re: populate listbox with multiple columns

    Your code, as it is, only returns one column of data.

    That column consists of unique values from column F on sheet 'PRData' where the value in column B matches the value in C11 on sheet 'PR'.

    What other columns do you want to display in the listbox?
    If posting code please use code tags, see here.

  7. #7
    Registered User
    Join Date
    06-18-2014
    Location
    philippines
    MS-Off Ver
    2007
    Posts
    11

    Re: populate listbox with multiple columns

    c,e,g,h,i,k,l,m

  8. #8
    Registered User
    Join Date
    06-18-2014
    Location
    philippines
    MS-Off Ver
    2007
    Posts
    11

    Re: populate listbox with multiple columns

    Quote Originally Posted by Norie View Post
    Your code, as it is, only returns one column of data.

    That column consists of unique values from column F on sheet 'PRData' where the value in column B matches the value in C11 on sheet 'PR'.

    What other columns do you want to display in the listbox?
    good day,

    Is my request possible?

  9. #9
    Registered User
    Join Date
    06-18-2014
    Location
    philippines
    MS-Off Ver
    2007
    Posts
    11

    Re: populate listbox with multiple columns

    Good day,

    Is there a way to populate listbox with multiple selected column based on vlookup typed in textbox?

    Please need help...

    Thnx...

  10. #10
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: populate listbox with multiple columns

    You are over complicating this. Load Columns C to D then hide the columns you do not need.


    Please Login or Register  to view this content.
    Last edited by mehmetcik; 11-08-2018 at 10:41 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  11. #11
    Registered User
    Join Date
    06-18-2014
    Location
    philippines
    MS-Off Ver
    2007
    Posts
    11

    Re: populate listbox with multiple columns

    I am sorry if I made it complicated.. I did type TEXTBOX instead of a certain cell in worksheet "PR"... sorry...

    My aim is to populate a listbox with multiple columns, 2 - 4 columns.

    The process in my worksheet is that, I open a userform then I type a certain value in textbox which is linked to a cell H12 from sheet "PR". Then in C11, there is a formula that transform the value in H12 to a certain format to be identified by vlookup in sheet "PRdata" in column B.

    Then I was hoping to populate the listbox with data from sheet "PRdata", columns E-F, dependent from vlookup.
    Or if possible extract from columns E-F, L, O, & Q.

    Hope I was able to explain clearly...

    Thank you...
    Last edited by willsnake; 11-08-2018 at 10:16 PM.

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: populate listbox with multiple columns

    The file you uploaded has only 1 shieet with 2 columns of data.

    What do you expect us to do from such workbook?

  13. #13
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: populate listbox with multiple columns

    I will try again

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    06-18-2014
    Location
    philippines
    MS-Off Ver
    2007
    Posts
    11

    Re: populate listbox with multiple columns

    good day,

    Sorry again... please ignore my attachment, it is the workbook that I refer when coding...

    I would like to modify the code which will make it extract data to listbox with multiple columns... such data will be from selected columns from data sheet.

    HTML Code: 
    I only ask for an idea on what to modify in the code to work the way I wanted...

    what part should I modify/add in this area?
    HTML Code: 
    for what I understand, this code
    HTML Code: 
    lets the code to extract data in 6th column or column F.
    How will I modify it to extract data from selected columns before listing it the listbox?
    How will I add columns E, G, & H data in the listbox?
    Last edited by willsnake; 11-09-2018 at 05:01 AM.

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

    Re: populate listbox with multiple columns

    Use Advanced Filter to filter your data to a temporary location.
    Then you can use something like this
    Please Login or Register  to view this content.
    to fill your ListBox. The Array of numbers represent the columns you want visible in your ListBox.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  16. #16
    Registered User
    Join Date
    06-18-2014
    Location
    philippines
    MS-Off Ver
    2007
    Posts
    11

    Re: populate listbox with multiple columns

    Good day,

    Thank you sir... I had it working now with this code

    HTML Code: 

+ 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. Use one ListBox on Userform to populate multiple cells
    By rainyroon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-28-2015, 04:33 PM
  2. Populate listbox - split into multiple columns
    By Lukael in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-25-2014, 02:49 PM
  3. [SOLVED] Single Select Multi Columns Listbox to Populate value in Textbox
    By puuts in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2014, 01:00 PM
  4. Adapt code to populate listbox with selected worksheet columns...
    By RayJay01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-17-2013, 09:54 PM
  5. Populate listbox with 2 columns and 2 ranges
    By questionguy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-17-2012, 05:04 PM
  6. [SOLVED] Populate listbox columns with entries from textboxes on userform
    By AndyE in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2012, 11:05 PM
  7. [SOLVED] Populate Listbox from 2 columns based on search keyword from text box
    By sivakumar123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-05-2012, 12:22 AM

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