double condition et somme
RE à tous!!
Encore un petit souci m'emmène!!!:?
Voilà en fait je réalise une macro qui devrait servir à effectuer une somme sous 2 conditions
En clair si dans la colonne 13 la valeur est "client" et que dans la colonne 24 la valeur est "payé" alors on fait la somme
-des lignes de la colonne 16 qu'on mettre sur une autre feuille en .cells(6,3)
-des lignes de la colonne 20 qu'on mettre sur une autre feuille en .cells(6,4)
A l'heure actuelle la macro n'effectue pas une somme correcte
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
Dim c As Long, a As Long, b As Long, t As Long
Dim Somme As Long,
Dim Som As Long,
Dim toto As String, titi As String
Dim d
Somme = 0
Som = 0
d = "avril" & Format(Date, "yyyy")
If FeuilleExiste(ThisWorkbook, d) Then
For i = 5 To Sheets(d).Cells(Rows.Count, 13).End(xlUp).Row
For j = 5 To Sheets(d).Cells(Rows.Count, 24).End(xlUp).Row
toto = Sheets(d).Cells(i, 13).Value
titi = Sheets(d).Cells(i, 24).Value
With Sheets(d)
For b = 5 To 500 '.Cells(Rows.Count, 13).End(xlUp).Row
If toto = Client And titi = Closed Then
Som = Som + .Cells(b, 16).Value
Somme = Somme + .Cells(b, 20).Value
End If
Next b
With Sheets("Récap")
.Cells(6, 3) = Somme
.Cells(6, 4) = Som
End With
Next j
Next i
End With
End If
End Sub |
Quelqu'un pourrait me donner un coup de main?
Merci