Hi,
I have a Userform with a listbox. I would like to transfer all items within this listbox to a cell in a worksheet.
Anyone any ideas on how to do this?Please Login or Register to view this content.
Thanks
Hi,
I have a Userform with a listbox. I would like to transfer all items within this listbox to a cell in a worksheet.
Anyone any ideas on how to do this?Please Login or Register to view this content.
Thanks
Hi colin7
Just checking I am reading correctly, "you want to transfer ALL items in a 'listbox' to a 'cell' "
A copy of your 'workbook' would be useful to be able to give a solution suitable to your requirement.
Hi Torachan,
Yes listbox1 on my userform will be populated with items as follows;
Programmes
Site visits
Method Statement
Health and Safety
I want to add this list of items to the 4th column in the table on the worksheet.
lastrow.Range.Value = Array(TextBox1, TextBox2, TextBox3, ListBox1, TextBox4). This transfers all the textbox values ok but leaves the listbox blank
Thanks
Last edited by colin7; 02-14-2020 at 09:12 AM.
How is your listbox initially populated ?
Just add item like so
listbox1.AddItem "Site Visits"
listbox1.AddItem "Programmes"
etc
Then when I click command button on userform I want to add the list into the table on the worksheet.
Thanks
Rarely do I spend my time pursuing something that makes no sense to me.
However what I have produced is my 'take' on the specification.
I still do not see a purpose, if in the unlikely event I have translated the spec correct, please explain the reasons for the event.
Hi Torachan,
Firstly thanks so much for taking the time to help me with this, it is much appreciated.
You have nearly got it working the way I need but just a few wee tweaks hopefully.
I have attached a file for you to see the outcome I am looking.
Again thank you very much for your help!
How aboutPlease Login or Register to view this content.
Torachan/Fluff13,
Thanks to both of you for your help with this.
Fluff13 your code works perfect. Just one thing. Sometimes I may not have 4 items in the listbox. There could be anything between 1 and 10 items in it depending on the particular Project.
Your code works perfect when I have 4 items but if there is more than 4 it doesn't pick it up. Is this something easy enough to fix?
Thank you
How aboutPlease Login or Register to view this content.
Fluff13,
This works perfectly now. Thanks very much to yourself and Torachan for all your help, I really appreciate it!
You're welcome & thanks for the feedback
Thanks for feedback.
Still fascinated how the stored four liner is used within the wider program.
As you have stated the number of items in the listbox will vary, why not store/feed from a sheet table rather than hard code, easier to maintain.
Its quite complicated but it works for me. I have 20+ checkboxes on a Userform. When I click on the checkboxes required for that project it adds them items to the listbox. Once populated I click a command button to update several worksheets. There may be a better way of doing this but this seems to work quite well for me.
Thanks again for your help, its much appreciated!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks