Populating a multi-column listbox from another list box
Posted on 2014-11-18
I have two list boxes in an Excel User Form. I want the user to select an item from ListBox1 and copy the data to ListBox2.
ListBox1 and ListBox2 have identical number of columns, 2 and one bound column.
When I had only one column of data, the command button to move the selected item from ListBox1 to ListBox2 worked:
Private Sub CommandButton3_Click()
Dim i As Integer
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then ListBox2.AddItem ListBox1.List(i)
What do I need to change in the above VBA to move both columns?