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
|
Private Sub ComboBox1_Change()
Valeur
End Sub
Private Sub ComboBox2_Change()
Valeur
End Sub
Private Sub ComboBox3_Change()
Valeur
End Sub
Sub Valeur()
Dim Plage As Range
Dim Cel As Range
Dim Col As Integer
Dim Lig As Integer
If ComboBox1.Text <> "" And ComboBox2.Text <> "" And ComboBox3.Text <> "" Then
With ActiveSheet: Set Plage = .Range(.Cells(1, 1), .Cells(1, .Columns.Count).End(xlToLeft)): End With
Set Cel = Plage.Find(ComboBox1.Text, , xlValues, xlWhole)
If Not Cel Is Nothing Then Col = Cel.Column
With ActiveSheet: Set Plage = .Range(.Cells(1, 1), .Cells(.Rows.Count, 1).End(xlUp)): End With
Set Cel = Plage.Find(ComboBox2.Text, Plage(Plage.Count), xlValues, xlWhole)
If Not Cel Is Nothing Then Lig = Cel.Row
With ActiveSheet: Set Plage = .Range(.Cells(Lig, 2), .Cells(Lig + 2, 2)): End With
Set Cel = Plage.Find(ComboBox3.Text, , xlValues, xlWhole)
If Not Cel Is Nothing Then Lig = Cel.Row
If Lig <> 0 And Col <> 0 Then Cells(Lig, Col).Value = TextBox1.Text
End If
End Sub |
Partager