Multi column listbox from combobox values

C

christobal

Have a user form which consists of 4 comboboxes populated from workshee
ranges. I require a procedure that upon click of command button on sam
form populates a multi column listbox in the same form containing th
values selected previously.
After editing is complete another command button saves the data in th
listbox to a range(B7:E56) on the worksheet
 
T

Tom Ogilvy

Listbox1.AddItem Combobox1.Value
listbox1.List(listbox1.Listcount-1,1).Value = Combobox2.Value
listbox1.List(listbox1.Listcount-1,2).Value = Combobox3.Value
listbox1.List(listbox1.Listcount-1,3).Value = Combobox3.Value

Range("B7").Resize(Listbox1.Listcount-1,4).Value = Listbox1.List
 
C

christobal

Why this error see row 3 with regards row 4



Listbox1.AddItem Combobox1.Value

listbox1.List(listbox1.Listcount-1,1).Value = Combobox2.Value

this next row returns Object required (Error 424)
listbox1.List(listbox1.Listcount-1,2).Value = Combobox3.Value
listbox1.List(listbox1.Listcount-1,3).Value = Combobox3.Value

Range("B7").Resize(Listbox1.Listcount-1,4).Value = Listbox1.Lis
 
T

Tom Ogilvy

My mistake, you don't need the value on the end. And the last combobox
should be Combobox4

Private Sub CommandButton1_Click()
ListBox1.AddItem ComboBox1.Value
ListBox1.List(ListBox1.ListCount - 1, 1) = ComboBox2.Value
ListBox1.List(ListBox1.ListCount - 1, 2) = ComboBox3.Value
ListBox1.List(ListBox1.ListCount - 1, 3) = ComboBox4.Value
End Sub
 

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

Top