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
| Dim plage As Range
Set plage = Sheets("Pays").Range("A1:A" & [A65536].End(xlUp).Row)
codrecherché = ComboBox1.Value
i = 0
For Each Cell In plage
If Cell.Value = codrecherché Then
UserForm1.ListBox1.ColumnCount = 2
UserForm1.ListBox1.ColumnWidths = "40;100"
UserForm1.ListBox1.AddItem
UserForm1.ListBox1.Column(0, i) = Cell.Address
UserForm1.ListBox1.Column(1, i) = Cell(1, 2)
i = i + 1
End If
Next Cell
End Sub
Private Sub UserForm_Initialize()
dernLigne = Sheets("Pays").Range("A" & Rows.Count).End(xlUp).Row
Dim i As Integer
dernLigne = Sheets("Pays").Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To dernLigne
ComboBox1 = Sheets("Pays").Range("A" & i)
If ComboBox1.ListIndex = -1 Then ComboBox1.AddItem Sheets("Pays").Range("A" & i)
Next i
End Sub |
Partager