Somme d'une colonne
a
Rebonjour
comment calculer la somme d'une colonne
j'ai trouver ça mais ça ne marche pas
Range("AC2") = Application.Sum(Somme_Montant_Total_Reglement)g
Bonjour
Essaie comme ça , en changeant la lettre F par celle de ta colonne :
Range("AC2") = WorksheetFunction.Sum(Range("F:F"))
Bye !
a
SA NE MARCHE TJRS PAS
voici mon code
Sub MONTANT_INDEMNITE_PRINCIPALE()
Dim Date_Souscription_Adhésion As Range, Statut_Technique_Sinistre As Range
Dim Montant_Ind_Principale As Range
Dim DernLigne As Long
Dim nblignes(1 To 12, 2013 To 2017) As Long
Dim i, j, k As Integer
Dim a, b, c, d, e, somme As Integer
Dim s As String
With Worksheets("Sinistre")
DernLigne = .Range("A" & .Rows.Count).End(xlUp).Row
Set Date_Souscription_Adhésion = .Range("G2:G" & DernLigne)
Set Montant_Ind_Principale = .Range("AB2:AB" & DernLigne)
Set Statut_Technique_Sinistre = .Range("V2:V" & DernLigne)
End With
a = LBound(nblignes, 2)
e = UBound(nblignes, 2)
For i = 2 To DernLigne
s = Cells(i, "V").Value
If s <> "Terminé - Refusé après instruction" Then
If a <= Year(Cells(i, 21).Value) And Year(Cells(i, 21).Value) <= e Then
j = Month(Cells(i, 7).Value)
k = Year(Cells(i, 7).Value)
nblignes(j, k) = nblignes(j, k) + 1
somme = WorksheetFunction.Sum(Cells(i, "AB").Value)
End If
End If
Next i
For i = 1 To 12
For k = a To e
Sheets("Feuil4").Cells(i + 1 + (k - 2013) * 12, 6).Value = somme
Next k
Next i
End Subg
Joins ton fichier et on regardera de plus près...
Bye !
a
bonjour
en fait j'ai un tcd mais au lieu du tcd j'ai envie de faire une macro
pour mon tcd j'ai les date de souscription en ligne, en filtre le statue technique, et en somme valeurs jai Montant indemnité principale
voici mon fichier en pièce jointe
merci pour votre aide
voici mon code mais sa ne marche pas :
Sub MONTANT_INDEMNITE_PRINCIPALE()
Dim Date_Souscription_Adhésion As Range, Statut_Technique_Sinistre As Range
Dim Montant_Ind_Principale As Range
Dim DernLigne As Long
Dim nblignes(1 To 12, 2013 To 2017) As Long
Dim i, j, k As Integer
Dim a, b, c, d, e, somme As Integer
Dim s As String
With Worksheets("Feuil1")
DernLigne = .Range("A" & .Rows.Count).End(xlUp).Row
Set Date_Souscription_Adhésion = .Range("G2:G" & DernLigne)
Set Montant_Ind_Principale = .Range("AB2:AB" & DernLigne)
Set Statut_Technique_Sinistre = .Range("V2:V" & DernLigne)
End With
a = LBound(nblignes, 2)
e = UBound(nblignes, 2)
For i = 2 To DernLigne
s = Cells(i, "V").Value
If s <> "Terminé - Refusé après instruction" Then
If a <= Year(Cells(i, 21).Value) And Year(Cells(i, 21).Value) <= e Then
j = Month(Cells(i, 7).Value)
k = Year(Cells(i, 7).Value)
nblignes(j, k) = nblignes(j, k) + Cells(i, "AB").Value
End If
End If
Next i
For i = 1 To 12
For k = a To e
Sheets("Feuil4").Cells(i + 1 + (k - 2013) * 12, 6).Value = nblignes(i, k)
Next k
Next i
End Sub