bonsoir a tous et toutes
j'ai ce code depuis 3 où 4 ans et je viens de le retrouver comme on dit au fond d'un tiroir
c'est un code qui déclenche les combobox l'un après l'autre sur la feuille, mais je voudrais le mettre sur userform mais la ça ne fonctionne plus la combobox 1 ne se charge pas d'ou les autres non plus
bon je vous prépare le classeur avec les code sur feuille et j'y place un userform, en attendant voici le code
je ne pense pas qu'il y ai grand chose a faire mais la je ne vois pas
Option Explicit
Dim NoAction As Boolean
Public Sub ComboBox1_Change()
Dim i As Integer
NoAction = True
ComboBox2.Clear
For i = 1 To 4
ComboBox2.AddItem Sheets("Feuil2").Cells(i, 3 + ComboBox1.ListIndex)
Next i
ComboBox2.ListIndex = 0
'ComboBox2.Activate
ComboBox2.SetFocus
SendKeys "^(F4)"
NoAction = False
End Sub
Private Sub ComboBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 16 Then
ComboBox2.DropDown
End If
End Sub
Private Sub ComboBox2_Change()
Dim i As Integer
NoAction = True
ComboBox3.Clear
For i = 7 To 11
ComboBox3.AddItem Sheets("Feuil2").Cells(i, 3 + ComboBox1.ListIndex)
Next i
ComboBox3.ListIndex = 0
'ComboBox3.Activate
ComboBox3.SetFocus
SendKeys "^(F4)"
NoAction = False
End Sub
Private Sub ComboBox3_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 16 Then
ComboBox3.DropDown
End If
End Sub
Private Sub ComboBox3_Click()
If NoAction Then Exit Sub
MsgBox "Vous avez sélectionnés - " & ComboBox1.Text & " - " & ComboBox2.Text & " - " & ComboBox3.Text
End Sub
Private Sub ComboBox3_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
MsgBox "Vous avez sélectionnés - " & ComboBox1.Text & " - " & ComboBox2.Text & " - " & ComboBox3.Text
End Sub
me revoilà avec un exemple