I have a existing UserForm. I need, in the UserForm_Initialize code to add any number of listboxes which I expect I could due with a loop.
But, I can’t determine the code to create a new listbox.
I have a existing UserForm. I need, in the UserForm_Initialize code to add any number of listboxes which I expect I could due with a loop.
But, I can’t determine the code to create a new listbox.
Something like this
![]()
Please Login or Register to view this content.
Why do you need/want to add multiple listboxes at run time?
If posting code please use code tags, see here.
Thanks Andy, exactly what I needed.
Norie,
I need as many listboxes as a variable quantity the calculations determine.
There might be 4 today and 20 tomorrow. There is no upper limit so I can't just have 20 listboxes and only show the ones I need. The user has to provide an input for each instance.
Since the options are always the same, I could just have them select & submit multiple times off a single listbox, but that;s too much for the user to keep track of in his head.
Additionally, there is sometimes a second option to choose so if the total is 5, there could be (5) listboxAoptions & 2 listboxBoptions. If the total is 20, there could be (20) listboxAoptions and (4) listboxBoptions, or 20 of each A & B.
The user really needs to be able to see the whole picture, what he chose for each instance.
I know Andy solved your problem but what if your UserForm has room for 30 and you'll need 35 listboxes?
I had a similar thing but I added the maximum amount ever to be needed, hid them all and unhid the ones I did need.
Just a thought.
carsto
I wasn't actually going to suggest adding multiple listboxes at design time etc.![]()
jolivanes - There is no "maximum", the potential needed is unlimited
Norie, I'm just trying to explain my thoughts to those so willing to help!
I thought about adding another listbox when they filled out the first, and so on and so on because they don't actually have to choose options every time, they can use the program default selection but they must be able to change the default selection for any or all.
The problem I'm running into is the value of all this isn't worth the time I'm spending on it. (Worth it to me as education, but not to my employer!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks