I found this great bit of code on here. It copies the 1st item (column) of a list box to another list box. The problem is i need it to copy more than one of the columns, about 4 or 5. I'm not VB literate, so i woundered if someone could help me out, if its possible to do it. Many Thanks in advance.
mike
Private Sub Command4_Click()
Dim lst1 As ListBox, lst2 As ListBox
Dim itm As Variant
Set lst1 = Me!List7
Set lst2 = Me!List2
' Check selected items.
For Each itm In lst1.ItemsSelected
' Set RowSource property for first selected item.
If lst2.RowSource = "" Then
lst2.RowSource = lst1.ItemData(itm)
Else
' Check whether item has already been copied.
If Not InStr(lst2.RowSource, lst1.ItemData(itm)) > 0 Then
lst2.RowSource = lst2.RowSource & ";" & lst1.ItemData(itm)
End If
End If
Next itm
End Sub
mike
Private Sub Command4_Click()
Dim lst1 As ListBox, lst2 As ListBox
Dim itm As Variant
Set lst1 = Me!List7
Set lst2 = Me!List2
' Check selected items.
For Each itm In lst1.ItemsSelected
' Set RowSource property for first selected item.
If lst2.RowSource = "" Then
lst2.RowSource = lst1.ItemData(itm)
Else
' Check whether item has already been copied.
If Not InStr(lst2.RowSource, lst1.ItemData(itm)) > 0 Then
lst2.RowSource = lst2.RowSource & ";" & lst1.ItemData(itm)
End If
End If
Next itm
End Sub