Bonjour
hum on dirais un devoir
mes bon voila une réponse
Private Sub UserForm_Initialize()
ComboBox1.List = Array("Type", "Nom")
ComboBox2.Visible = False
End Sub
Private Sub ComboBox1_Change()
If ComboBox1.Value = "Nom" Then
ComboBox2.Visible = True
ComboBox2.Clear
With Sheets(Feuil2.Name)
ComboBox2.List = Application.Transpose(.Range(.Range("A1"), .Cells(1, Columns.Count).End(xlToLeft)))
End With
Else
ComboBox2.Visible = False
End If
End Sub
Private Sub Button1_Click()
if TextBox1.Value = "" then exit sub
With Sheets(Feuil2.Name)
If ComboBox1.Value = "Type" Then
Dercol = .Cells(1, Columns.Count).End(xlToLeft).Column + 1
.Cells(1, Dercol).Value = TextBox1.Value
Else
Col = ComboBox2.ListIndex + 1
DerLig = .Cells(Rows.Count, Col).End(xlUp).Row + 1
.Cells(DerLig, Col).Value = TextBox1.Value
End If
End With
Unload Me
End Sub
A+
Maurice