Re : USF Recherche intuitive
re,
cela se passe ici voir couleur rouge
Private Sub UserForm_Initialize()
Set f = Sheets("création")
nbcol = f.[A2].CurrentRegion.Columns.Count
Me.ListBox1.ColumnCount = nbcol
Set plage = f.[A2].CurrentRegion
Set plage = plage.Resize(plage.Rows.Count - 1)
Me.ListBox1.List = plage.Value
i = 1
x = 15
For i = 1 To nbcol
retour = Me.Controls.Add("Forms.Label.1", "Label" & i, True)
Me("label" & i).Caption = f.Cells(1, i)
Me("label" & i).Top = 45
Me("label" & i).Left = x
x = x + f.Columns(i).Width * 1.1
temp = temp & f.Columns(i).Width * 1.1 & ";"
Next
Me.ListBox1.ColumnWidths = temp
For b = 1 To nbcol: Set Lbl(b).GrLabel = Me("Label" & b): Next b
End Sub
Private Sub Textmot_Change()
Me.ListBox1.Clear
i = 0
Set plage = f.[A2].CurrentRegion
Set plage = plage.Offset(2).Resize(plage.Rows.Count - 1)
Set c = plage.Find(Me.Textmot, , , xlPart)
If Not c Is Nothing Then
premier = c.Address
Do
Me.ListBox1.AddItem
lig = c.Row - plage.Row + 1
For col = 1 To nbcol
Me.ListBox1.List(i, col - 1) = plage.Cells(lig, col)
Next col
i = i + 1
Set c = plage.FindNext(c)
Loop While Not c Is Nothing And c.Address <> premier
End If
End Sub