Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$13:$B$13" Then
Set d1 = CreateObject("Scripting.Dictionary")
For Each c In [produit]: d1(c.Value) = "": Next c
For Each c In d1.keys: temp = temp & c & ",": Next c
Target.Validation.Delete
Target.Validation.Add xlValidateList, Formula1:=Left(temp, Len(temp) - 1)
End If
'-- niv 2
If Target.Address = "$C$13:$D$13" Then
Set d1 = CreateObject("Scripting.Dictionary")
For Each c In [parement]
If c.Offset(0, -1) = Target.Offset(0, -2) Then d1(c.Value) = ""
Next c
If d1.Count > 0 Then
For Each c In d1.keys: temp = temp & c & ",": Next c
Target.Validation.Delete
Target.Validation.Add xlValidateList, Formula1:=Left(temp, Len(temp) - 1)
End If
End If
'---niv3
If Target.Address = "$E$13:$G$13" Then
Set d1 = CreateObject("Scripting.Dictionary")
For Each c In [finition]
If c.Offset(0, -2) = Target.Offset(0, -4) And _
c.Offset(0, -1) = Target.Offset(0, -2) Then d1(c.Value) = ""
Next c
If d1.Count > 0 Then
For Each c In d1.keys: temp = temp & c & ",": Next c
Target.Validation.Delete
Target.Validation.Add xlValidateList, Formula1:=Left(temp, Len(temp) - 1)
End If
End If
'--- niv 4
If Target.Address = "$H$13" Then
Set d1 = CreateObject("Scripting.Dictionary")
For Each c In [HT]
If c.Offset(0, -3) = Target.Offset(0, -7) And _
c.Offset(0, -2) = Target.Offset(0, -5) And _
c.Offset(0, -1) = Target.Offset(0, -3) Then d1(c.Value) = ""
Next c
If d1.Count > 0 Then
For Each c In d1.keys: temp = temp & c & ",": Next c
Target.Validation.Delete
Target.Validation.Add xlValidateList, Formula1:=Left(temp, Len(temp) - 1)
End If
End If
End Sub