Re : Liste déroulante 2 colonnes
Noms de champ:
AVIONS =DECALER(Data!$E$2;;;NBVAL(Data!$E:$E)-1;3)
CODE_OACI =DECALER(Data!$A$2;;;NBVAL(Data!$A:$A)-1;4)
Attention! il faut d'abord définir les noms avec une colonne, faire les listes et enfin modifier les noms avec 3 et 4 colonnes.
Le code est à placer dans Feuil5:
-clic-droit onglet
-Visualiser le code
Private Sub Worksheet_Change(ByVal Target As Range)
If (Target.Column = 3) And Target.Count = 1 Then
p = Application.Match(Target, Application.Index([avions], , 1), 0)
If IsError(p) Then
Application.EnableEvents = False
Target = [mémo]
Application.EnableEvents = True
Else
ActiveWorkbook.Names.Add Name:="mémo", RefersToR1C1:="=" & Chr(34) & Target.Value & Chr(34)
End If
End If
If (Target.Column = 6) And Target.Count = 1 Then
p = Application.Match(Target, Application.Index([code_oaci], , 1), 0)
If IsError(p) Then
Application.EnableEvents = False
Target = [mémo]
Application.EnableEvents = True
Else
ActiveWorkbook.Names.Add Name:="mémo", RefersToR1C1:="=" & Chr(34) & Target.Value & Chr(34)
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If (Target.Column = 3 Or Target.Column = 6) And Target.Count = 1 Then
ActiveWorkbook.Names.Add Name:="mémo", RefersToR1C1:="=" & Chr(34) & Target.Value & Chr(34)
End If
End Sub
JB