bonjour,
voici comment mon combobox remplit,
Private Sub UserForm_Initialize()
Dim t As Integer
lr = Worksheets("Feuil1").Range("A10000").End(xlUp).Row
For t = 3 To lr
Me.ComboBox1.AddItem Worksheets("Feuil1").Cells(t, 1)
Me.ComboBox2.AddItem Worksheets("Feuil1").Cells(t, 10)
Next t
With ListBox1
.ColumnCount = 12
.ColumnWidths = "80 pt;100 pt;80 pt;80 pt;45 pt;120 pt;80 pt;80 pt;80 pt;60 pt;60 pt;45 pt"
End With
End Sub
ma listbox est remplit appartir d'un bouton de recherche
Private Sub chercher_Click()
Dim Text As String
If ComboBox1.ListIndex = -1 Then
MsgBox " Vous avez omis de préciser l'objet de votre rechercehe " & Text & " Reformulez votre deamande ", vbCritical, Sign
Exit Sub
End If
'ListBox1.clear
'****************************************************
'Moteur de Recherche
'****************************************************
Dim c As Range
Dim Tablo() As String
'Dim Text As String
Dim s As Byte
Dim Firstaddress As String
Dim i As Integer, x As Integer, L As Integer
Text = Me.ComboBox1
If Text = "" Then Exit Sub
'<>
For s = 1 To Worksheets.Count
If Worksheets(s).Name = "Feuil1" Then
With Sheets(s).UsedRange
Set c = .Find(Text, LookIn:=xlValues, LookAt:=xlPart)
If Not c Is Nothing Then
Firstaddress = c.Address
Do
ReDim Preserve Tablo(12, i)
For x = 1 To 12
Tablo(x - 1, i) = c.Offset(0, x - c.Column).Text
Next x
Tablo(12, i) = Sheets(s).Name
Tablo(12, i) = c.Address(0, 0)
i = i + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> Firstaddress
End If
End With
End If
Next s
If i = 0 Then
MsgBox " Référence " & Text & " inexistante ", vbCritical, Sign
Exit Sub
End If
Me.ListBox1.Column() = Tablo()
End Sub
aider moi svp.