bonjour a vous tous
dans ce codela combobox est alimentée par la colonneD
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 Private Sub UserForm_Initialize() Sheets("feuil1").Activate Dim Cell As Range 'LstView pour Trier For Each Cell In Range("d3:d" & [D65000].End(xlUp).Row).SpecialCells(xlCellTypeVisible) ListView1.ListItems.Add = Cell Next 'liste triée sans doublon For vLi = 1 To ListView1.ListItems.Count ComboBox1 = ListView1.ListItems(vLi) If ComboBox1.ListIndex = -1 Then ComboBox1.AddItem ListView1.ListItems(vLi) Next ListView1.ListItems.Clear 'ComboBox1 = "" End Sub Private Sub ComboBox1_Click() Sheets("feuil1").Activate Dim Plage As Range, Est, Add As String, vLi As Integer, Vcol As Byte With ListBox1 .Clear .ColumnCount = 12 .ColumnWidths = "50;50;50;80;120;130;50;30;30;70;30;30" Set Plage = Range("D3:P" & [D65000].End(xlUp).Row) Set Est = Plage.Find(ComboBox1) If Not Est Is Nothing Then Add = Est.Address Do .AddItem Cells(Est.Row, 1) For Vcol = 1 To 6 .List(vLi, Vcol - 1) = Cells(Est.Row, Vcol) Next vLi = vLi + 1 Set Est = Plage.FindNext(Est) Loop While Not Est Is Nothing And Est.Address <> Add End If TextBox1 = .ListCount End With End Sub
j'ai augmenté le nombre de colonne dans la listbox, mais le contenu des colonnes supplémentaires ne s'inscrit pas dans la listbox
j'aurais en tout16 colonnes de A à P
Pascal
Partager