Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Fin: If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, [J2]) Is Nothing Then
Dim DL%, Tliste, ListeName$, i%
AccordCadre = Target
DL = Sheets("Marchés").[A65500].End(xlUp).Row
Tliste = Sheets("Marchés").Range("A2:F" & Sheets("Marchés").[A65500].End(xlUp).Row)
ListName = "="
For i = 1 To UBound(Tliste)
Tliste(i, 1) = Tliste(i, 1) & " (" & Tliste(i, 2) & ")"
If Tliste(i, 1) = AccordCadre Then
ListeName = ListeName & Tliste(i, 6) & ","
End If
Next i
ListeName = Mid(ListeName, 1, Len(ListeName) - 1) ' On retire le dernier ";"
With Range("J8:J22").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=ListeName
End With
End If
Fin:
End Sub