two multi-column listboxes

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

Guest

How can I copy the info from each column and row in a multicolumn listbox
into another multicolumn listbox?

I already have it set to cycle throught the itemsselected in the rows, but
cannot get the columns to move too.

Both boxes are multiselect, and box2 is set to Value List.

I think what i need is to cycle through each row, and for each row, cycle
through each column and bring back the text, build a string of each row +
columns, then display it , row and column by column, in box two, but my VBA
skills are not up to task.

Any help would be greatly appreciated.

Thanks
 
Since list 2 is a value list, you will have to add to it using the columns in
list1:

Dim strLst As String

strLst2 = Me.Lst2.Rowsource
strLst2 = strLst2 & ";" & Me.Lst1.Column(0)
strLst2 = strLst2 & ";" & Me.Lst1.Column(1)
strLst2 = strLst2 & ";" & Me.Lst1.Column(2)
Me.Lst2.RowSource = strLst2
Me.Lst2.Requery
 
Never mind, I solved the problem. For those of you with similar problems...

dim rowitem as variant
dim colitem as variant
dim stritem as string

for each rowitem in [controlname].itemsselected
for colitem = 0 to [number of columns]

stritem = stritem & [controlname].column (colitem, rowitem) & ";"

next colitem
[2nd list box].additem item=stritem
next rowitem
 
Back
Top