How to populate listbox with textbox?

Vba populate list box from text box entries

  • I have 4 textboxes on a userform (named vendor1,2,3,&4 respectively). When the next userform is loaded, I want a listbox to populate with whatever is entered into the 4 textboxes. I was trying to use the additem method but I'm missing something to properly identify the values. So far I have this: Private Sub UserForm_Initialize() 'populate the list box with vendor names With Me.vendorlist .AddItem vendor1.Value .AddItem vendor2.Value .AddItem vendor3.Value .AddItem vendor4.Value End With End Sub Can you tell me what I'm doing wrong? It will work if I identify items in "" but it won't recognize the reference to the textbox value. I appreciate any help you can offer.

  • Answer:

    There is nothing on here that looks wrong as such EXCEPT that it is only referencing itself, and you did specify that this code is INITIALIZE ¨C at the initialize stage, there are no values in vendor1, vendor2 etc ¨C are these boxes on a previous userform, or are you closing and reopening this one ¨C if a previous userform then reference it (so forms1.vendorlist.value for example) else store the data in a temporary area on the spreadsheet and reference that instead.

Miningco.com Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.