09/04/2008, 22h30
|
#12 (permalink)
|
|
XLDnaute Occasionel
Date d'inscription: décembre 2006
Localisation: Pontarlier
Version Excel : Excel 2003 (PC)
Messages: 296
|
Re : mise à jour listbox
Re bonsoir à tous
Voici encore un petit souci ;mais là c'est avec mon USF Edit ;voila mon souci;lorsque je j'ajoute mes ingrédients encore une fois pas de problème;mais ma listbox ne se remet pas à jour et en voici la cause :Le remplissage de ma list box se fait sur la recherche d'équivalence sur une colonne et que le code me renvoi que les lignes qui se suivent,et la bien entendu puisque je suis en édition ;les infos ne se suivent pas toujours.Je mets le code qui me pose un peu problème et si quelqu'un pouvait me décoincer se serait vraiment super.
Citation:
Private Sub AjourIngrdt()
Dim Cel As Range, Index&, L As Integer, Tbl As Variant, TblI As Variant
Dim Li As Integer
Set RgIngrdts = F4.Range("A2", F4.Range("A65536").End(xlUp))
Set Cel = RgIngrdts.Find(LabID)
If Cel Is Nothing Then Exit Sub
Do While Cel = LabID 'compte
L = L + 1
Set Cel = Cel.Offset(1, 0)
Loop
ReDim Tbl(1 To L, 1 To 4)
Set Cel = RgIngrdts.Find(LabID)
If Cel Is Nothing Then Exit Sub
L = 0
Do While Cel = LabID 'rempli
L = L + 1
Tbl(L, 1) = Cel(1, 3) 'listingid
Tbl(L, 2) = Cel(1, 3) 'listingid
Tbl(L, 3) = Cel(1, 4) 'quantité
Tbl(L, 4) = Cel(1, 5) 'unité
Set Cel = Cel.Offset(1, 0)
Loop
TblI = F5.Range("A2:C" & F5.Range("A65536").End(xlUp).Row)
For L = 1 To UBound(Tbl, 1)
For Li = 1 To UBound(TblI, 1)
If Tbl(L, 2) = TblI(Li, 1) Then 'compare listingid
Tbl(L, 2) = TblI(Li, 2) 'remplace listingid par ingrédient
Exit For
End If
Next Li
Next L
With ListBoxIngrdts
.Clear
.ColumnCount = 4
.ColumnWidths = "0;140;30;30"
.List = Tbl
.ListIndex = -1
End With
End Sub
|
Merci d'avance
|
|
|