![]() |
adding multiple columns to a listbox
I have a UserForm with various ComboBoxes and Labels. At the click of a
CommandButton, I would like to add these items to 7 different columns in a listbox. The comboboxes and labels will then go blank to be filled in again and when the CommandButton is clicked again the list box adds another row with the new items, and so on. Do I have to use an array for this or just additem/list. Please help. |
adding multiple columns to a listbox
first thing set column count
mylistbox.columncount = 9 9 is max then to setvalues mylistbox.list(rownumber,columnnuber) = "mydata1" mylistbox.list(rownumber,columnnuber) = "mydata2" mylistbox.list(rownumber,columnnuber) = "mydata2" mylistbox.list(rownumber,columnnuber) = "mydata2" etc.... note rownumber and columnnumber start at 0 ben -- When you lose your mind, you free your life. "ndm berry" wrote: I have a UserForm with various ComboBoxes and Labels. At the click of a CommandButton, I would like to add these items to 7 different columns in a listbox. The comboboxes and labels will then go blank to be filled in again and when the CommandButton is clicked again the list box adds another row with the new items, and so on. Do I have to use an array for this or just additem/list. Please help. |
adding multiple columns to a listbox
Thanks for the help Ben.
Dim rowNumber, columnNumber ListBox1.ColumnCount = 7 ListBox1.List(rowNumber, columnNumber) = ComboBoxClt ListBox1.List(rowNumber, columnNumber) = LabelCltNme ListBox1.List(rowNumber, columnNumber) = ComboBoxWrk ListBox1.List(rowNumber, columnNumber) = LabelWrkNme ListBox1.List(rowNumber, columnNumber) = ComboBoxYr ListBox1.List(rowNumber, columnNumber) = TextBoxTme ListBox1.List(rowNumber, columnNumber) = TextBoxNtv I get an error message saying "Could not set the list property. Invalid property array index". I'm sure I have misunderstood what you meant. "ben" wrote: first thing set column count mylistbox.columncount = 9 9 is max then to setvalues mylistbox.list(rownumber,columnnuber) = "mydata1" mylistbox.list(rownumber,columnnuber) = "mydata2" mylistbox.list(rownumber,columnnuber) = "mydata2" mylistbox.list(rownumber,columnnuber) = "mydata2" etc.... note rownumber and columnnumber start at 0 ben -- When you lose your mind, you free your life. "ndm berry" wrote: I have a UserForm with various ComboBoxes and Labels. At the click of a CommandButton, I would like to add these items to 7 different columns in a listbox. The comboboxes and labels will then go blank to be filled in again and when the CommandButton is clicked again the list box adds another row with the new items, and so on. Do I have to use an array for this or just additem/list. Please help. |
All times are GMT +1. The time now is 11:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com