Bonjour,
Je reviens vers vous car je sèche encore...

J'utilise excel 365

j'ai un tableau sur une feuille excel 'tissu' avec 5 colonnes. La 1ere est la famille, la 2eme est sous-famille, la 3eme est le nom du produit, la 4 est le prix et la 5 la largeur du produit

Crosscut Dacron HSX 625 12,20 € 1,37
Crosscut Dacron HSX 626 13,20 € 1,35
Crosscut Dacron HSX 627 14,20 € 1,33
Crosscut Dacron HSX 628 15,20 € 1,29
Crosscut Dacron HSX 629 16,20 € 1,27
Crosscut Polyester HPX 433 8,40 € 1,25
Crosscut Polyester HPX 533 9,85 € 1,23
Crosscut Polyester HPX 633 10,76 € 1,21
Crosscut Polyester HPX 733 11,42 € 1,19
Crosscut Polyester HPX 833 13,02 € 1,17
Tri-radial CL CL 25 19,50 € 1,15
Tri-radial CL CL 35 22,50 € 1,13
Tri-radial CL CL 45 25,50 € 1,09
Tri-radial DC DC 12 23,00 € 1,07
Tri-radial DC DC 22 26,25 € 1,05
Tri-radial DC DC 32 29,50 € 1,03
Tri-radial Spi Nylon Nylite 0,75 8,12 € 0,99
biradiale CZ CZ 15 18,40 € 0,97
biradiale Monofilm MN45 12,00 € 0,93

Comment faire pour afficher une liste dans une combobox avec deux conditions?

Dans ma combobox3, une fois que j'ai choisi ma sous-famille, ça me récupère tous les produits qui correspondent à la sous-famille, alors que je souhaiterais tous les produits qui correspondent à la sous-famille ET à la famille (l'info du combobox1) ...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
 
 
Option Explicit
 
' *********************
' ** combo n°1 coupe **
' *********************
Private Sub UserForm_Initialize()
 
 
Dim Dico
Dim Cel As Range
    Set Dico = CreateObject("Scripting.Dictionary")
    With Worksheets("tissu")
 
        For Each Cel In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
            If Not Dico.Exists(Cel.Value) Then
                Dico.Add Cel.Value, Cel.Value
                Me.ComboBox1.AddItem Cel.Value
            End If
        Next Cel
    End With
 
 
End Sub
 
' *****************************
' ** combo n°2 famille tissu **
' *****************************
Private Sub ComboBox1_Change()
Dim Dico
Dim Cel As Range
 
    With Worksheets("tissu")
 
        For Each Cel In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
 
                If Cel.Value = Me.ComboBox1.Value Then
                Me.ComboBox2 = Cel.Offset(, 1).Value
               If ComboBox2.ListIndex = -1 Then ComboBox2.AddItem Cel.Offset(, 1).Value
            End If
        Next Cel
    End With
 
End Sub
 
' *************************
' ** combo n°3 tissu **
' *************************
Private Sub ComboBox2_Change()
 
Dim Cel As Range
    With Worksheets("tissu")
        For Each Cel In .Range("B2", .Range("B" & Rows.Count).End(xlUp))
            If Cel.Value = Me.ComboBox2.Value Then
'            If Cel.Value(-1, 0) = ComboBox1.Value Then
                Me.ComboBox3.AddItem Cel.Offset(, 1).Value
            End If
'            End If
        Next Cel
    End With
 
End Sub
 
 
' *************************
' ** récupération   prix **
' *************************
Private Sub ComboBox3_Change()
Dim Cel As Range
 
    With Worksheets("tissu")
        For Each Cel In .Range("C2", .Range("C" & Rows.Count).End(xlUp))
            If Cel.Value = Me.ComboBox3.Value Then
 
Range("B6").Value = ComboBox1.Value ' affiche la coupe en B6
Range("B7").Value = ComboBox2.Value ' affiche la famille tissu en B7
Range("B8").Value = ComboBox3.Value ' affiche le tissu en B8
Range("B9").Value = Cel.Offset(, 1).Value ' affiche le prix du tissu choisi en B9
Range("C9").Value = Cel.Offset(, 2).Value ' affiche la largeur du tissu choisi en C9
 
            End If
 
        Next Cel
    End With
Unload FormCoupe ' vide et ferme le formuaire
End Sub

Merci pour votre aide

Jean-Yves