adding multiple columns to a listbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top