Bonjour,

J'ai un formulaire qui contient 4 OptionButton qui déterminent la valeur de ComboBox1 Puis ComboBox1 contrôle la valeur de Combobox2. Cependant il semblerait que dans mon code il y ait quelque chose qui m'empêche de donner une valeur à ComboBox3 (qui est indépendant des deux autres). Mon code en entier est le suivant:

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
 
Private Sub BoltsButton_Click()
 Me.ComboBox1.Clear
 Options
End Sub
 
Private Sub ComboBox3_Change() 'J'ai aussi utilisé Me.ComboBox3.List = Sheets("Feuil1").Range("Thickness").Value et cela ne fonctionne pas
  With Me.ComboBox3
   .AddItem "1"
   .AddItem "2"
   .AddItem "3"
  End With
End Sub
 
 
Private Sub ScrewsButton_Click()
 Me.ComboBox1.Clear
 Options
End Sub
 
Private Sub SheetsButton_Click()
 Me.ComboBox1.Clear
 Options
End Sub
 
Private Sub Options()
 Select Case True
  Case SheetsButton
   Me.ComboBox1.List = Sheets("Feuil1").Range("A1:A3").Value
  Case BoltsButton
   Me.ComboBox1.List = Sheets("Feuil1").Range("A5:A10").Value
  Case ScrewsButton
   Me.ComboBox1.List = Sheets("Feuil1").Range("A12:A16").Value
  Case Else
   Me.ComboBox1.List = Sheets("Feuil1").Range("A18:A25").Value
 End Select
End Sub
 
Private Sub VariousButton_Click()
 Me.ComboBox1.Clear
 Options
End Sub
 
Private Sub ComboBox1_Change()
 Dim Materiau As String
 Dim c As Range
 
 Me.ComboBox2.Clear
 If Me.ComboBox1.ListIndex > -1 Then
  Materiau = Me.ComboBox1
  Set c = Worksheets("Feuil1").Range("A:A").Find(Materiau, LookIn:=xlValues, Lookat:=xlWhole)
  If Not c Is Nothing Then
   Me.ComboBox2.List = Application.Transpose(c.Offset(, 1).Resize(, 4).Value)
   Set c = Nothing
  End If
 End If
End Sub
Je voudrais aussi que ComboBox3 ne soit activé que quand SheetsButton l'est. Comment faire? J'ai essayé .Enabled mais ça ne fonctionne pas.