+ Reply to Thread
Results 1 to 5 of 5

Populate textbox with particular column from multiselect listbox

  1. #1
    Registered User
    Join Date
    06-27-2012
    Location
    Kansas, United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Populate textbox with particular column from multiselect listbox

    Good morning,

    Frustration has gotten the best of me, I cannot resolve this easy (I think...) issue.

    I have 4 columns which populate listbox1. I intend to have the listbox only show items in the first column [Clause]. This I'm able to do.

    I would then like to have 2 separate textboxes, that each pull different columns based on the listbox multi selection.

    I'd like the first textbox to show results for the columns [Clause] and [Plan].

    The second textbox I would like results of [Clause], [Action], and [Responsible Party].

    To start out I tried to just get one column put into the textbox, though no luck.

    Any thoughts? I've attached a sample workbook that mimics the format of my real data.

    A further goal would be to ensure that the results in the textboxes are easy discernable by clause, some of the information in the [Plan] and [Action] columns will be multiple lines with blank spaces, so if a delineation of a bunch of '-----------' could be inserted between each line that would make it much, much easier to read.

    Thanks!
    Attached Files Attached Files

  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,720

    Re: Populate textbox with particular column from multiselect listbox

    You are using A:D as a RowSource. This will include over a million rows. I have added a named formula that will automatically select the actual data.

    You are using your column headings as data. This allows the user to click on the headings. The named formula also takes care of this, and I set ColumnHeads to True.

    The textbox MultiLine property must be set to True.

    There is a spacing problem in the textboxes that needs a little more thought.

    Similar logic applied to the second textbox.

    I have not looked at your last item at all yet.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    06-27-2012
    Location
    Kansas, United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Populate textbox with particular column from multiselect listbox

    Thanks Jeff! A great start - I'll need to think more on spacing.

  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,720

    Re: Populate textbox with particular column from multiselect listbox

    Quote Originally Posted by dale.lebar View Post
    A further goal would be to ensure that the results in the textboxes are easy discernable by clause, some of the information in the [Plan] and [Action] columns will be multiple lines with blank spaces, so if a delineation of a bunch of '-----------' could be inserted between each line that would make it much, much easier to read.
    I have given this some more thought and a little experimentation. Fields with multiple lines will be difficult to format into a text box. The text box has no inherent columns, it's just plain lines of text. If you include a long field, or a multiline field, it won't be confined to a column, it will just go to the end of the line and wrap around. Doing the kind of formatting you want in a textbox is difficult for two reasons:

    1. You have to measure the length of every text string and pad with blanks where necessary to make it fit where you want it. Tabs can be used strategically to help with wraparound but don't solve the whole problem.
    2. Unless you use a fixed-width font like Courier, there is no good way to know how many points of space a word or phrase will take up in the textbox, making #1 even more difficult.


    Consider putting your output to a worksheet rather than textboxes on a form. That makes all this formatting trivial.

  5. #5
    Registered User
    Join Date
    06-27-2012
    Location
    Kansas, United States
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Populate textbox with particular column from multiselect listbox

    I am definitely open to outputting the results to a worksheet rather than textboxes. the team that will be using this was briefed that the output would be through the textboxes, though I'm positive I can demonstrate why it would be better to output to a worksheet.

+ 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] populate a listbox ased on textbox value in userform
    By justlearning123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-09-2015, 06:48 PM
  2. Listbox and Userform to populate textbox - Help!
    By reyreyreyes in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-22-2015, 01:32 PM
  3. [SOLVED] (ActiveX) Populate Listbox With Textbox
    By elsg in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-25-2015, 02:22 PM
  4. call a cell value from listbox and populate into textbox value
    By molesy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2014, 05:26 AM
  5. UserForm: Enable Textbox When "Other" Selected in MultiSelect Listbox (Excel 2010)
    By excelforumkeys in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-02-2014, 06:40 PM
  6. Help! How do i populate a cell with the values selected from a multiselect listbox?
    By mamakamsi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-12-2013, 11:48 AM
  7. Multiselect form listbox - selected values to be copied and pasted in a column
    By Ath01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-04-2013, 01:37 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