ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Putting items from list box multi-select onto worksheet (https://www.excelbanter.com/excel-programming/292723-putting-items-list-box-multi-select-onto-worksheet.html)

ericd

Putting items from list box multi-select onto worksheet
 
I'm trying to get items picked from a multi-select list box onto my Excel 2000 active worksheet. Obviously I've had no luck. All examples I've looked at on the Knowledge base seem useless. So far, no matter what I try, the items picked only show up in a Message Box. I've created a Userform with a listbox and command button. The command button is supposed to determine which list items have been picked and put them in the worksheet. A separate macro in the worksheet calls up the Userform. The following code is what I started with. I tried to activate the worksheet, dump the results into an array, etc., but nothing seems to work. Any help on this would be GREATLY appreciated

Sub CommandButton1_Click(
' Loop through the items in the ListBox control
For x = 0 To ListBox1.ListCount -

' If the item is selected..
If ListBox1.Selected(x) = True The

Msg = ListBox1.List(x) *** Note: Even if this is commented out, the results still come up on a "message box" like window. Also, all other methods tried so far produce the same results. ****
End I

Next

' Close the UserForm
'Unload M

End Su
Sub Button3_Click(
Userform1.Sho
End Su



All times are GMT +1. The time now is 02:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com