Private Sub ListBox1_Change()
Dim cell As Range, cell1 As Range
'Choix multiple vers résumé
Label4.ForeColor = &H80000012
With Me.ListBox1
If Not .Selected(.ListIndex) Then Exit Sub
End With
'// contrôle existence de la sélection date/agent dans le tableau de la feuille BDD
With Feuil1.ListObjects(1)
Set cell = .ListColumns("Date").Range.Find(CDate(Me.TextBox1))
If Not cell Is Nothing Then
Set cell1 = cell
Do
With Me.ListBox1
If cell.Offset(, 1) = .List(.ListIndex) Then
MsgBox "Mouvement date/agent déjà enregistré " & vbCrLf & vbCrLf & _
Space(5) & "Date......... : " & cell.Value & vbCrLf & _
Space(5) & "Agent....... : " & cell.Offset(, 1).Value & vbCrLf & _
Space(5) & "Module.... : " & cell.Offset(, 2).Value & vbCrLf & _
Space(5) & "Séquence : " & cell.Offset(, 4).Value
With Me.ListBox1: .Selected(.ListIndex) = False: End With
Exit Sub
End If
End With
Set cell = .ListColumns("Date").DataBodyRange.FindNext(cell)
Loop Until cell.Address = cell1.Address
End If
End With
End Sub