+ Reply to Thread
Results 1 to 7 of 7

Adding TextBox Value Next to Existing Item in ListBox

  1. #1
    Registered User
    Join Date
    08-31-2014
    Location
    Edmonton, Alberta, Canada
    MS-Off Ver
    2010
    Posts
    27

    Adding TextBox Value Next to Existing Item in ListBox

    Hey all.

    I am probably going about this the completely wrong way, but I set a form up in a specific manner, and now I am trying to figure out a way to make this work. I will try to explain the process as clearly as I can. Maybe it won't seem so complicated once I type it out.

    I have a UserForm that contains a ListBox (ListBox1). Here is the code for this box:

    Please Login or Register  to view this content.
    I have a TextBox (TextBox1) that shows a date.

    Is there a way to have the text in TextBox1 appear next to select items in the ListBox. I realize that the code I am about to show you doesn't work, but perhaps it will illustrate my point:

    Please Login or Register  to view this content.
    Any suggestions/ solutions would be greatly appreciated.

    Thanks!

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,964

    Re: Adding TextBox Value Next to Existing Item in ListBox

    The code appears to work for me. I invoked it as follows

    Please Login or Register  to view this content.
    Please see the attachment
    Attached Files Attached Files
    Martin

    If my solution has saved you time and/or money, please consider sponsoring my run in the 2020 London Marathon in aid of Cancer Research UK.

    https://uk.virginmoneygiving.com/MartinRice

  3. #3
    Registered User
    Join Date
    08-31-2014
    Location
    Edmonton, Alberta, Canada
    MS-Off Ver
    2010
    Posts
    27

    Re: Adding TextBox Value Next to Existing Item in ListBox

    I forgot to mention that the TextBox starts blank and that it will change based on user input.

    The location of the ListBox is within a tab. Should I place the code under the Sub for a tab change so that it refreshes?

    Is there something special that needs to be done to make that happen?

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 (Win 10 - Work) & Office 365 Subscription Insider (Win 10 - Home)
    Posts
    36,042

    Re: Adding TextBox Value Next to Existing Item in ListBox

    It woudl be easier to help if you provided a sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  5. #5
    Registered User
    Join Date
    08-31-2014
    Location
    Edmonton, Alberta, Canada
    MS-Off Ver
    2010
    Posts
    27

    Re: Adding TextBox Value Next to Existing Item in ListBox

    Quote Originally Posted by AliGW View Post
    It woudl be easier to help if you provided a sample workbook.
    It is exactly what mrice had created except the textbox starts blank.

    I have gotten the code to work when I populate the ListBox after the date has been entered, but I want to be able to replace the ListBox's contents should there be a change to this date.

  6. #6
    Registered User
    Join Date
    08-31-2014
    Location
    Edmonton, Alberta, Canada
    MS-Off Ver
    2010
    Posts
    27

    Re: Adding TextBox Value Next to Existing Item in ListBox

    Alright. So I found a working solution.

    I have added the code so that any time there is a change in page it will clear the listbox and repopulate it based on the new information.

    This keeps it up to date every time a user switches screens.

    Thanks for letting me bounce ideas off you folks!

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 (Win 10 - Work) & Office 365 Subscription Insider (Win 10 - Home)
    Posts
    36,042

    Re: Adding TextBox Value Next to Existing Item in ListBox

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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