Afficher les titres dans la ListBox et Recherche
Le_Troll_Du_27Membre fidèle
- Messages
- 156
- Excel
- 2019 FR 64 Bits
- Inscrit
- 14/07/2015
- Emploi
- Ex-Conducteur Routier de convoi exceptionnel
Bonjour le forum,
Je souhaiterai afficher les titres dans la ListBox.
Cette listbox sert à effectuée une recherche dans une plage prédéfini.
Soit par une TextBox soit par une ComboBox.
Private Sub UserForm_Initialize()
ListBox1.Clear
ListBox1.ColumnHeads = True
With ListBox1
.ColumnCount = 56
.ColumnWidths = "40;70;80;80;80;80;60;100;0;0;0;0;0;0;0;0;0;0;0;0;0;0;130;110;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;80;80"
End With
ListBox1.List = Wsl.Range("A2:BP" & Wsl.Range("A" & Rows.Count).End(xlUp).Row).Value
'TxtB_Recherche.SetFocus
End Sub
Private Sub Initialise_ListBox1()
Dim t As Byte
Sheets("Listing").Select
With ListBox1
For t = 1 To 68
Userform3.Controls("TextBox" & t) = .List(.ListIndex, t - 1)
Next t
End With
End Sub
Private Sub UserForm_Layout()
TextBox10 = Format(TextBox10.Value, "00 000")
TextBox14 = Format(TextBox14.Value, "00 000")
TextBox48 = Format(TextBox48.Value, "dd/mm/yyyy")
TextBox51 = Format(TextBox51.Value, "### ##0.00 €")
TextBox55 = Format(TextBox55.Value, "dd/mm/yyyy")
TextBox56 = Format(TextBox56.Value, "dd/mm/yyyy")
TextBox57 = Format(TextBox57.Value, "dd/mm/yyyy")
TextBox62 = Format(TextBox62.Value, "dd/mm/yyyy")
TextBox65 = Format(TextBox65.Value, "dd/mm/yyyy")
TextBox68 = Format(TextBox68.Value, "dd/mm/yyyy")
' ---------------------------------------------------------------------------------------------
' Date et heure dans le Lbl_Date_Heure
Lbl_Date_Heure.Caption = "Nous somme le : " & Format(Now(), "dd mmmm yyyy") & ", il est " & Format(Now(), "hh : mm") & " heure"
' N° de ligne sélectionné dans la ListBox1
Lbl_Numero_Ligne = "Ligne " & ListBox1.ListIndex + 1
' Affiche le nombre de sélection dans l'USF
Lbl_Quantite_Contact.Caption = "Il y A .... " & ListBox1.ListCount & " contact(s) de répertorier"
End Sub
Private Sub ListBox1_Click(): Initialise_ListBox1: UserForm_Layout: End Sub
Cordialement
Le_Troll_Du_27Membre fidèle
- Messages
- 156
- Excel
- 2019 FR 64 Bits
- Inscrit
- 14/07/2015
- Emploi
- Ex-Conducteur Routier de convoi exceptionnel
Bonjour le forum
Voilà ou j'en suis
Je me sers de la TxtB_Recherche pour recherche dans la colonne D "Noms"
Private Sub TxtB_Recherche_Change()
Clé = "*" & UCase(Me.TxtB_Recherche) & "*"
n = 0
For i = LBound(Plage) To UBound(Plage)
If UCase(Plage(i, 1)) Like Clé Or UCase(Plage(i, 4)) Like Clé Then
n = n + 1
ReDim Preserve b(1 To 68, 1 To n)
For e = 1 To 68
b(e, n) = Plage(i, e)
Next e
End If
Next i
If n > 0 Then
ReDim Preserve b(1 To 68, 1 To n + 1)
Me.ListBox1.List = Application.Transpose(b)
Me.ListBox1.RemoveItem n
End If
End Sub
dans la ListBox1:
Private Sub ListBox1_Click()
For t = 1 To 68
Me.Controls("TextBox" & t) = ListBox1.List(ListBox1.ListIndex, t - 1)
Next t
UserForm_Layout
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Affichage_Controls
For M = 1 To 68: Me.Controls("CheckBox" & M).Value = True: Next M
End Sub
et
Private Sub UserForm_Initialize()
With Me
.StartUpPosition = 3
.Left = .Left + 262
.Top = .Top + 75
End With
Set Wsl = Sheets("Listing")
Set Wsz = Sheets("Feuille Temporaire")
ListBox1.Clear
ListBox1.ColumnHeads = True
With ListBox1
.ColumnCount = 56 .ColumnWidths = "40;70;80;80;80;80;60;100;0;0;0;0;0;0;0;0;0;0;0;0;0;0;130;110;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;0;80;80"
End With
Plage = Wsl.Range("A2:BP" & Wsl.Range("A" & Rows.Count).End(xlUp).Row).Value
Me.ListBox1.List = Plage
TxtB_Recherche.SetFocus
End Sub
Pour l'affichage de la listbox et la recherche est résolu
Manque que les titres dans la listbox
Comment Récupérer les titres?
Cordialement