+ Reply to Thread
Results 1 to 5 of 5

Combobox on a userform does not display the two columns

  1. #1
    Registered User
    Join Date
    07-08-2012
    Location
    Venezuela
    MS-Off Ver
    Excel 2010
    Posts
    62

    Combobox on a userform does not display the two columns

    Hi friends, looking for help again.

    I have written the following code to populate a two columns combobox on a Userform with data from a worksheet . The problem is that it only displays the second column (1), but if you select a row, the combobox text shows the first column data (0). I need:

    1. Both columns to be displayed in the list to help user to make the right choice.

    2. Combobox text displays the two columns of the selected row.


    Any help will be highly appreciated.

    Thank you so much.

    necalabria


    HTML Code: 

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

    Re: Combobox on a userform does not display the two columns

    What width are you trying to apply to the columns? The units are points so I am surprised you see even one column. 2 points is very, very small.

    Also I don't see advantage in populating an array then assigning the array to the combobox. You could just assign directly to the combobox.

    I have updated your code in this demo file.
    Attached Files Attached Files
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    07-08-2012
    Location
    Venezuela
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Combobox on a userform does not display the two columns

    Thank you so much 6StribgJazzer.

    Using an array is one method to populate a multicolumn combobox, yours is better. Therefore, I will use it.

    Right, the columns widths are wrong . I did not realized they are too small.

    Thanks again.

    necalabria

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

    Re: Combobox on a userform does not display the two columns

    Your welcome, I hope this helped.

    There is nothing wrong in using an array, but in your situation I don't think it's an advantage. It's not faster and it makes the code more complicated. In some situations it might be a good choice.

  5. #5
    Registered User
    Join Date
    07-08-2012
    Location
    Venezuela
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Combobox on a userform does not display the two columns

    Hi 6StringJazzer,

    Regarding the combobox.text displaying the selected two columns data, I tricked a little with two simple codes

    The first passed the columns data to the combobox.text and inserted " / " (ie: blank space-barslash-blank space) between them.

    The second one ( partially shown), splits the string in combobox.text in two parts in order to get the referencce to look for the right worksheet row to work with it.

    Thank you for your help and comments

    Code N° 1
    HTML Code: 

    Code N° 2
    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. [SOLVED] UserForm ComboBox Filter ListBox Display
    By Sintek in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-07-2017, 04:43 AM
  2. [SOLVED] userform display based on combobox selection
    By russkris in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-21-2016, 10:40 PM
  3. Userform ComboBox to display value from a list only once
    By HJHamm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-19-2015, 12:49 PM
  4. Userform Combobox to populate form: Can I change the order of the columns in the combobox?
    By CraigWiggins in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2014, 12:14 PM
  5. Need the Userform Combobox to display value from list only once
    By SHUTTEHFACE in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-18-2014, 04:58 PM
  6. display images on the userform when something out of a combobox is selected
    By Ghosty in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-18-2012, 06:07 AM
  7. [SOLVED] Why Won't The Date Display Correctly In A Userform Combobox?
    By ScotyB in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-09-2012, 02:14 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