Private Sub Worksheet_Change(ByVal Target As Range)
Dim crit1 As Range, crit2 As Range, col1%, col2%, tablo, v, i&, liste$
Set crit1 = [A2]: Set crit2 = [V2] 'à adapter
col1 = crit1.Column: col2 = crit2.Column
tablo = Sheets("mére").[A1].CurrentRegion 'matrice, plus rapide
If Not Intersect(Target, crit1) Is Nothing Then
crit1(1, 2).Resize(, Columns.Count - col1).ClearContents 'RAZ
v = crit1
For i = 2 To UBound(tablo)
If tablo(i, col1) = v Then liste = liste & "," & Replace(tablo(i, col2), ",", ".")
Next
With crit2.Validation
.Delete
If liste <> "" Then .Add xlValidateList, Formula1:=Mid(liste, 2) 'crée la liste
End With
ElseIf Not Intersect(Target, crit2) Is Nothing Then
v = crit1 & Chr(1) & Replace(crit2, ",", ".")
For i = 2 To UBound(tablo)
If tablo(i, col1) & Chr(1) & Replace(tablo(i, col2), ",", ".") = v Then
Application.EnableEvents = False 'désactive les évènements
[A2].Resize(, UBound(tablo, 2)) = Application.Index(tablo, i, 0)
Application.EnableEvents = True 'réactive les évènements
Exit For
End If
Next
End If
End Sub