Bonjour Mellul, bonjour le forum,
J'ai bien galéré sur ce coup là. Je pensais y arriver en ne créant qu'une seule ListBox mais il m'a fallu en crée une par onglet. En pièce jointe le fichier qui semble être fonctionnel. Il y a une partie générale dans le composant ThisWorkbook :
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Dim LD As Worksheet
Dim TV As Variant
Set LD = Worksheets("Liste déroulante")
TV = LD.Range("A2:A" & LD.Cells(Application.Rows.Count, "A").End(xlUp).Row).Value
activesheet.ListBox1.MultiSelect = fmMultiSelectMulti
Select Case Sh.Name
Case "Liste déroulante", "TUTO"
Case Else
If Not Intersect(Sh.Range("C2:C" & Sh.Cells(Application.Rows.Count, "A").End(xlUp).Row), Target) Is Nothing And Target.Count = 1 Then
activesheet.ListBox1.MultiSelect = fmMultiSelectMulti
activesheet.ListBox1.List = TV
a = Split(Target, "-")
If UBound(a) >= 0 Then
For i = 0 To activesheet.ListBox1.ListCount - 1
If Not IsError(Application.Match(activesheet.ListBox1.List(i), a, 0)) Then activesheet.ListBox1.Selected(i) = True
Next i
End If
activesheet.ListBox1.Height = 80
activesheet.ListBox1.Width = 100
activesheet.ListBox1.Top = Target.Top
activesheet.ListBox1.Left = Target.Left + Target.Width
activesheet.ListBox1.Visible = True
Else
activesheet.ListBox1.Visible = False
End If
End Select
End Sub
Et une autre partie répétée dans chaque onglet (tout comme la ListBox1) :
Private Sub ListBox1_Change()
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then temp = IIf(temp = "", ListBox1.List(i), temp & "-" & ListBox1.List(i))
Next i
ActiveCell = temp
End Sub
Le fichier :