Private Sub ListBoxIdAnimal_Change()
If flag Then Exit Sub
flag = True
Dim i&, ID As Variant
For i = 0 To ListBoxPerson.ListCount - 1
ListBoxPerson.Selected(i) = False
Next i
ID = Application.VLookup(ListBoxIdAnimal.List(ListBoxIdAnimal.ListIndex, 0), [TbLiaison].Columns(2).Resize(, 3), 3, 0)
ListBoxPerson.TopIndex = 0
If Not IsError(ID) Then
For i = 0 To ListBoxPerson.ListCount - 1
If ListBoxPerson.List(i, 0) = ID Then ListBoxPerson.Selected(i) = True: ListBoxPerson.TopIndex = i: Exit For
Next i
End If
flag = False
End Sub
Private Sub ListBoxPerson_Change()
If flag Then Exit Sub
flag = True
Dim i&, ID, c As Range, dossier$, cadre As Boolean
For i = 0 To ListBoxIdAnimal.ListCount - 1
ListBoxIdAnimal.Selected(i) = False
Next i
ID = ListBoxPerson
ListBoxIdAnimal.TopIndex = 0
For Each c In [TbLiaison].Columns(4).Cells
If c = ID Then
dossier = CStr(c(1, -1))
For i = 0 To ListBoxIdAnimal.ListCount - 1
If ListBoxIdAnimal.List(i, 0) = dossier Then
ListBoxIdAnimal.Selected(i) = True
If Not cadre Then cadre = True: ListBoxIdAnimal.TopIndex = i
Exit For
End If
Next i
End If
Next c
flag = False
End Sub