Populating a multicolumn Listbox from 2 other Listboxes

stirlingmw

Board Regular
Joined
Feb 18, 2013
Messages
75
I have a Userform which I can pass data from one ListBox to another. This works well with one list of data that is to be transferred over. However, i need to add another column of data.
I have 2 Listboxes "Role" and "Name" which now should make up a list item to be passed into a third listbox "Owner". Both items should then be removed from their original listboxes so that they cannot be selected again.
the code i am currently using to transfer data in one column is as follows:

Code:
Private Sub BTN_MoveSelectedRight_Click()


    Dim iCtr As Long


    For iCtr = 0 To Me.ListName.ListCount - 1
           
        If Me.ListName.Selected(iCtr) = True Then
           Me.ListBox2.AddItem Me.ListName.List(iCtr)
        End If
    Next iCtr


    For iCtr = Me.ListName.ListCount - 1 To 0 Step -1
        If Me.ListName.Selected(iCtr) = True Then
            Me.ListName.RemoveItem iCtr
        End If
    Next iCtr
End Sub

Can this be modified so that Listbox2 will contain an additional Column to include "ListRole"?

Thanks

Steve
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,223,630
Messages
6,173,456
Members
452,514
Latest member
cjkelly15

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top