listbox

G

germain

Guest
Bonjour a tous,

voila jai cree une userform avec une listbox avec 3 colonnes et avec un bouton pour valider
jaimerai que quand je clique sur valider on ne voie que 1 ou 2 colonne de ma listbox grace a la commande ListBox2.ColumnWidths

voila le mon code pour linstant

Private Sub CommandButton2_Click()
Dim Cherche As String
Dim L As Integer
Dim Maplage As Range
Dim FirstADdress As String
Dim C As Object, Tableau() As Variant
ReDim Tableau(100, 3)
Cherche = TextBox4
If Cherche = "" Then
Exit Sub
End If
ListBox2.ColumnWidths = 0
UserForm1.Caption = "Démo Mode Recherche"

L = Sheets("Fabricants").Range("A65536").End(xlUp).Row
Set Maplage = Sheets("Fabricants").Range("A4:C" & L)
Compteur = 0
ListBox2 = ""
With Maplage
Set C = .Find(Cherche, LookIn:=xlValues)
If Not C Is Nothing Then
FirstADdress = C.Address
Do
Tableau(Compteur, 0) = Cells(C.Row, 1)
Tableau(Compteur, 1) = Cells(C.Row, 2)
Tableau(Compteur, 2) = Cells(C.Row, 3)
Compteur = Compteur + 1
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> FirstADdress
End If
End With
ListBox2.List() = Tableau
End Sub

Merci d'avance
 

Membres actuellement en ligne

Statistiques des forums

Discussions
313 020
Messages
2 094 433
Membres
106 024
dernier inscrit
Imado