PDA

View Full Version : Solved: Help transfer from Multi Column ComboBox to worksheet non ajacent columns



librkvn
07-20-2013, 12:06 PM
I need help in converting the following code to work with a combobox instead of listbox. I may be working with a row source that is several thousand rows long and listbox it would be to cumbersome for the user to use a listbox in this case?

Private Sub cmdAdd_Click()
Dim iListCount As Integer
Dim iRow As Integer
Dim rStartCell As Range
Set rStartCell = Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
For iListCount = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(iListCount) = True Then 'User has selected
ListBox1.Selected(iListCount) = False
iRow = iRow + 1
rStartCell.Cells(iRow, "A").Value = ListBox1.List(iListCount, 0)
rStartCell.Cells(iRow, "B").Value = ListBox1.List(iListCount, 1)
rStartCell.Cells(iRow, "D").Value = ListBox1.List(iListCount, 2)
End If
Next iListCount
Set rStartCell = Nothing
Unload Me
Range("C8").Select
End Sub

Kenneth Hobs
07-20-2013, 01:06 PM
You may not need rowsource.

Try making a simple example file to show what you want.

librkvn
07-20-2013, 02:06 PM
Please look at the original post thread above I uploaded the example file then

librkvn
07-20-2013, 03:39 PM
Please look at the original post thread above I uploaded the example file then

Kenneth Hobs
07-20-2013, 06:57 PM
I don't see a problem using the listbox over the combobox.

You can do it in a similar way. Here is a link to a kb article.
http://www.vbaexpress.com/kb/getarticle.php?kb_id=233

librkvn
07-21-2013, 03:18 AM
I don't see a problem using the listbox over the combobox.

You can do it in a similar way. Here is a link to a kb article.
http://www.vbaexpress.com/kb/getarticle.php?kb_id=233

The problem is scrolling through thousands of rows of data to find the record that your looking for. The list box not the best tool in this case.

Kenneth Hobs
07-22-2013, 05:36 AM
Still, I don't see an issue. Combobox will have the same number of entries.

Have you thought about setting the MatchEntry option to match complete?

mikerickson
07-22-2013, 06:39 AM
A multi-column combobox is very similar to a multi-column listbox.
But the OP code lookes like it is for a multi-select listbox.

There is no such thing as a multi-select combobox.