![]() |
Multi-select Combo Box
I currently load a dropdown combo box on a form and use additem method to populate it with data formatted from 6 columns and 100 rows on page 2 of the workbook. It would like to turn this control into a dropdown combo box or dropdown list box, with extended multi-select options.
Problems: Active X list box and combo box controls !) The dropdown combo box has no multi-select property. 2) The list box has no listrows property-data displays only one row at a time. Using the forms control box to add a drop down list box to a cell on the form 3) I cannot format the data properly for a drop down list box-cant display data using the additem method to format the data. Any idea how to create a multi-select combo box or a drop down list box that will show 10 rows of data in the drop down portion of the list box? |
Multi-select Combo Box
I think this is what you are after
below refers to I userform "userform1" and one listbox "listbox1" Just make sure that you develop the userform that you slect the multselect option for the listbox in the properties when you set up the userform I normally use the 2-fmMultiSelectExtended Private Sub UserForm_Activate() Dim vArr As Variant 'get data from worksheet "Data Sheet" With Worksheets("Data Sheet") 'The range is row 2, column 1 , to end of row j ' Set rng = Range(.Cells(2, 1), .Cells(Rows.Count, 10).End(xlUp)) vArr = rng.Value 'select form "UserForm1" and clear listbox of any data in it "Listbox1" UserForm1.ListBox1.Clear 'then retrieve the data j = -1 For i = LBound(vArr) To UBound(vArr) j = j + 1 'then paste list data into form "UserForm1"and listbox "Listbox1" 'define how many colums is in the listbox UserForm1.ListBox1.ColumnCount = 10 UserForm1.ListBox1.List = vArr Next End With End Sub "Dean" wrote in message ... I currently load a dropdown combo box on a form and use additem method to populate it with data formatted from 6 columns and 100 rows on page 2 of the workbook. It would like to turn this control into a dropdown combo box or dropdown list box, with extended multi-select options. Problems: Active X list box and combo box controls !) The dropdown combo box has no multi-select property. 2) The list box has no listrows property-data displays only one row at a time. Using the forms control box to add a drop down list box to a cell on the form 3) I cannot format the data properly for a drop down list box-can't display data using the additem method to format the data. Any idea how to create a multi-select combo box or a drop down list box that will show 10 rows of data in the drop down portion of the list box? |
Multi-select Combo Box
Thanks David,
I ended up using a list box and setting lstFoodList.Height = 135.5 using the lstFoodList got focus envent to show 10 rows of data at a time. I had to split the code for processing the lstFoodList selected items into a subroutine that checkes every item in the list to see if it was selected and if selected = ture, then sending each selected item to process the selected items. the lstFoodList LostFocus event is then usee to lstFoodList.Height is set back to the height of 1 row on the excel sheet lstFood.Height = 13.5 to show the data posted under the dropdown portion of the lstFoodList list box. "David Adamson" wrote: I think this is what you are after below refers to I userform "userform1" and one listbox "listbox1" Just make sure that you develop the userform that you slect the multselect option for the listbox in the properties when you set up the userform I normally use the 2-fmMultiSelectExtended Private Sub UserForm_Activate() Dim vArr As Variant 'get data from worksheet "Data Sheet" With Worksheets("Data Sheet") 'The range is row 2, column 1 , to end of row j ' Set rng = Range(.Cells(2, 1), .Cells(Rows.Count, 10).End(xlUp)) vArr = rng.Value 'select form "UserForm1" and clear listbox of any data in it "Listbox1" UserForm1.ListBox1.Clear 'then retrieve the data j = -1 For i = LBound(vArr) To UBound(vArr) j = j + 1 'then paste list data into form "UserForm1"and listbox "Listbox1" 'define how many colums is in the listbox UserForm1.ListBox1.ColumnCount = 10 UserForm1.ListBox1.List = vArr Next End With End Sub "Dean" wrote in message ... I currently load a dropdown combo box on a form and use additem method to populate it with data formatted from 6 columns and 100 rows on page 2 of the workbook. It would like to turn this control into a dropdown combo box or dropdown list box, with extended multi-select options. Problems: Active X list box and combo box controls !) The dropdown combo box has no multi-select property. 2) The list box has no listrows property-data displays only one row at a time. Using the forms control box to add a drop down list box to a cell on the form 3) I cannot format the data properly for a drop down list box-can't display data using the additem method to format the data. Any idea how to create a multi-select combo box or a drop down list box that will show 10 rows of data in the drop down portion of the list box? |
All times are GMT +1. The time now is 01:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com