Option Explicit
[COLOR=navy]Dim[/COLOR] Lst1 [COLOR=navy]As[/COLOR] Range, Lst2 [COLOR=navy]As[/COLOR] Range
[COLOR=navy]Dim[/COLOR] Trng [COLOR=navy]As[/COLOR] Range, Srng [COLOR=navy]As[/COLOR] Range
'[COLOR=green][B]'''''''''''''''''''''''''''''''''''''''''''''[/B][/COLOR]
'[COLOR=green][B]''''''''''''''''''''''''''''''''''''''''[/B][/COLOR]
Private [COLOR=navy]Sub[/COLOR] But_Sub_Click()
[COLOR=navy]If[/COLOR] Not Trng [COLOR=navy]Is[/COLOR] Nothing [COLOR=navy]Then[/COLOR]
[COLOR=navy]With[/COLOR] Sheets(Trng.Value)
.Columns(Trng.Next.Value).Clear
.Range(Trng.Next & "1").Resize(ListA.ListCount).Value = ListA.List
[COLOR=navy]End[/COLOR] With
[COLOR=navy]End[/COLOR] If
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]
'[COLOR=green][B]'''''''''''''''''''''''''''''''''''''''''''[/B][/COLOR]
Private [COLOR=navy]Sub[/COLOR] UserForm_Click()
[COLOR=navy]On[/COLOR] [COLOR=navy]Error[/COLOR] [COLOR=navy]Resume[/COLOR] [COLOR=navy]Next[/COLOR]
[COLOR=navy]Set[/COLOR] Trng = Application.InputBox(Left:=300, prompt:="Please [COLOR=navy]Select[/COLOR] Target Sheet ", Title:="Target Sht/Col", Type:=8)
[COLOR=navy]Set[/COLOR] Srng = Application.InputBox(Left:=300, prompt:="Please [COLOR=navy]Select[/COLOR] Source Sheet ", Title:="Source Sht/Col", Type:=8)
[COLOR=navy]With[/COLOR] Sheets(Trng.Value)
[COLOR=navy]Set[/COLOR] Lst1 = .Range(.Range(Trng.Next & "1"), .Range(Trng.Next & Rows.Count).End(xlUp))
[COLOR=navy]End[/COLOR] With
[COLOR=navy]With[/COLOR] Sheets(Srng.Value)
[COLOR=navy]Set[/COLOR] Lst2 = .Range(.Range(Srng.Next & "1"), .Range(Srng.Next & Rows.Count).End(xlUp))
[COLOR=navy]End[/COLOR] With
[COLOR=navy]With[/COLOR] UserForm1.ListA
.List = Lst1.Value
.MultiSelect = fmMultiSelectExtended
[COLOR=navy]End[/COLOR] With
[COLOR=navy]With[/COLOR] UserForm1.ListB
.List = Lst2.Value
.MultiSelect = fmMultiSelectExtended
[COLOR=navy]End[/COLOR] With
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]
'[COLOR=green][B]'''''''''''''''''''''''''''''[/B][/COLOR]
Private [COLOR=navy]Sub[/COLOR] But_Add_Click()
[COLOR=navy]Dim[/COLOR] Tran [COLOR=navy]As[/COLOR] [COLOR=navy]Integer,[/COLOR] Ray(), c [COLOR=navy]As[/COLOR] [COLOR=navy]Integer[/COLOR]
c = 0
[COLOR=navy]On[/COLOR] [COLOR=navy]Error[/COLOR] [COLOR=navy]Resume[/COLOR] [COLOR=navy]Next[/COLOR]
[COLOR=navy]For[/COLOR] Tran = 0 To ListA.ListCount - 1
[COLOR=navy]If[/COLOR] ListA.List(Tran) <> "" [COLOR=navy]Then[/COLOR]
ReDim Preserve Ray(c)
Ray(c) = ListA.List(Tran)
c = c + 1
[COLOR=navy]End[/COLOR] If
[COLOR=navy]Next[/COLOR] Tran
[COLOR=navy]For[/COLOR] Tran = 0 To ListB.ListCount - 1
[COLOR=navy]If[/COLOR] ListB.Selected(Tran) [COLOR=navy]Then[/COLOR]
ReDim Preserve Ray(c)
Ray(c) = ListB.List(Tran)
c = c + 1
[COLOR=navy]End[/COLOR] If
[COLOR=navy]Next[/COLOR] Tran
[COLOR=navy]With[/COLOR] ListA
.Clear
.List = Application.Transpose(Ray)
[COLOR=navy]End[/COLOR] With
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]
'[COLOR=green][B]'''''''''''''''''''''''''''''[/B][/COLOR]
Private [COLOR=navy]Sub[/COLOR] But_Remove_Click()
[COLOR=navy]Dim[/COLOR] Tran [COLOR=navy]As[/COLOR] [COLOR=navy]Integer,[/COLOR] c [COLOR=navy]As[/COLOR] [COLOR=navy]Integer,[/COLOR] Ray()
c = 0
[COLOR=navy]For[/COLOR] Tran = 0 To ListA.ListCount - 1
[COLOR=navy]If[/COLOR] Not ListA.Selected(Tran) [COLOR=navy]Then[/COLOR]
ReDim Preserve Ray(c)
Ray(c) = ListA.List(Tran)
c = c + 1
[COLOR=navy]End[/COLOR] If
[COLOR=navy]Next[/COLOR] Tran
[COLOR=navy]With[/COLOR] ListA
.Clear
[COLOR=navy]If[/COLOR] c > 0 [COLOR=navy]Then[/COLOR]
.List = Application.Transpose(Ray)
[COLOR=navy]End[/COLOR] If
[COLOR=navy]End[/COLOR] With
[COLOR=navy]End[/COLOR] [COLOR=navy]Sub[/COLOR]