De listbox à une feuille excel
bonsoir tous le monde
je récupère à l'aide d'un listbox des factures non réglées d'une feuille qui se présente ainsi :
N° Appel Bénéficiaire Année Mois Mnt réel Date règl.
98438638 BEN NASR 2015 Février 55.325 15/11/2016
98437437 ezzedine 2015 janvier 32.325
98520674 Maghzaoui 2016 mars 32.326
98438638 BEN NASR 2015 Avril 32.336
comme vous constatez que si la colonne F est vide veut dire que cette facture n'est pas réglée
voila mon code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Private Sub UserForm_Initialize()
ListBox1.Clear
ListBox1.ColumnCount = 5
ListBox1.ColumnWidths = "50;80;50;60;50"
Set f = Sheets("Feuil1")
i = f.Range("A65536").End(xlUp).Row
k = 0
For j = 2 To i
If f.Range("f" & j) = "" Then
Me.ListBox1.AddItem
Me.ListBox1.Column(0, k) = f.Range("A" & j).Value
Me.ListBox1.Column(1, k) = f.Range("B" & j).Value
Me.ListBox1.Column(2, k) = f.Range("c" & j).Value
Me.ListBox1.Column(3, k) = f.Range("d" & j).Value
Me.ListBox1.Column(4, k) = f.Range("e" & j).Value
k = k + 1
End If
Next j
End Sub |
puis je coche les facture à régler...un textbox fait le total des facture cochées
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| Private Sub CommandButton1_Click()
TextBox1.Value = 0
Dim g As Byte
Dim Total As Variant
For g = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(g) = True Then
Total = Total + CDbl(ListBox1.Column(4, g))
End If
Next g
TextBox1.Text = Total
End Sub
End Sub |
mon problème c'est quand je remplis un textbox2 avec la date de règlement (commune pour toutes les facture cochées...je veux que cette date soit enregistrée dans la colonne F - feuil1 et devant chaque facture cochée
j'espère etre claire....BONNE SOIRÉE A TOUS