Private Sub UserForm_Initialize()
Dim Tab1()
With Worksheets("TablesDéfinitives"): Tab1 = .Range(.Cells(2, 3), .Cells(.Rows.Count, 3).End(xlUp)).Value: End With
ListBox1.List = Tab1
With Worksheets("TablesDéfinitives"): Tab1 = .Range(.Cells(2, 4), .Cells(.Rows.Count, 4).End(xlUp)).Value: End With
ListBox2.List = Tab1
End Sub
Private Sub CommandButton1_Click()
Dim Plage As Range
Dim Cel As Range
Dim I As Integer
Dim LstChaine As String
With Worksheets("TablesDéfinitives"): Set Plage = .Range(.Cells(2, 4), .Cells(.Rows.Count, 4).End(xlUp)): End With
With ListBox1
For I = 0 To .ListCount - 1
If .Selected(I) = True Then
Set Cel = Plage.Find(.List(I), , xlValues, xlWhole)
If Not Cel Is Nothing Then LstChaine = LstChaine & .List(I) & vbCrLf Else ListBox2.AddItem .List(I)
End If
Next I
End With
If LstChaine = "" Then Exit Sub
MsgBox "Les éléments suivants n'ont pas été transférés car déjà présents dans la liste !" & vbCrLf & vbCrLf & LstChaine
End Sub