Somme d'une colonne de la listbox

Bonsoir,

svp pourriez vous jeter un coup d'oeil sur mon fichier je souhaite afficher la somme de la colonne 3 de la listbox2 "Montant T.T.C" sur la textbox4 "TOTAL VERSEMENT". le total ne doit comprendre que les montants dont la date annulation est vide

Egalement est ce que c'est possible que les montants de la colonnes 3 de la listbox2 soient alignés à droite

merci d'avance pour vos propositions

ci-joint le fichier

re,

pour l'alignement du texte soit c'est tout à gauche soit tout à droite, soit centré

Me.ListBox2.TextAlign = fmTextAlignRight

fmTextAlignLeft 1 fmTextAlignCenter 2 fmTextAlignRight 3

pour la somme:

modifie la macro ListBox1_Click par celle-ci,

Private Sub ListBox1_Click()
Dim liste As Variant, i As Long, j As Integer, n As Integer, cl As Variant, frm As Variant
Dim LB2(), NoPol As String, dt As String, rw As Long, tt As String
rw = Sheets("Feuil3").Cells(Rows.Count, 1).End(xlUp).Row
dt = Me.TextBox4
NoPol = Me.ListBox1.List(Me.ListBox1.ListIndex)
cl = Array(10, 11, 12, 13, 14, 15, 9)
frm = Array("0", "0", "#,##0.00", "dd/mm/yyyy", "dd/mm/yyyy", "dd/mm/yyyy", "0")
liste = Sheets("Feuil3").Range("A1:O" & rw).Value

For i = LBound(liste) To UBound(liste)

     If i = 1 Or liste(i, 1) = NoPol Then
        n = n + 1
        For j = LBound(cl) To UBound(cl)
          ReDim Preserve LB2(UBound(cl), n)
          LB2(j, n - 1) = Format(liste(i, cl(j)), frm(j))
        Next j

     End If

Next i
Me.ListBox2.List = Application.Transpose(LB2)

tt = "SUMPRODUCT((Feuil3!L2:L" & rw & ")*(Feuil3!A2:A" & rw & "=""" & NoPol & """)*(Feuil3!O2:O" & rw & "=0))"
Me.TextBox4 = Format(Evaluate(tt), "0.00")
End Sub

Vraiment top ca marche à merveille

Mille merci i20100

Rechercher des sujets similaires à "somme colonne listbox"