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
Related Q & A:
- How I can find string in excel with vba?Best solution by Stack Overflow
- Is it correct to extend a bean class and write a class which holds logic to populate the bean we extend?Best solution by stackoverflow.com
- How to list all text files in a directory?Best solution by Stack Overflow
- How do I make a text box on Myspace?Best solution by Yahoo! Answers
- How much is a post office box, or PO box?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.