votre aide svp

hajar

XLDnaute Nouveau
Bonjour,

Svp j’ai un programme qui me copie tous les données qui ce trouvent dans la feuille
« ETAT » vers la feuille « TABLEAU ».

Mais j’ai un petit problème, et comme je ne suis pas très forte en vb, je compte sur votre précieuse aide ! svp

Ma question et :

Comment je peux faire pour que mon programme détecte que les codes sur la colonne « D » sont les mêmes et me fait le cumul de leur « pht » qui ce trouve dans la colonne « E ».

Ci-joint le fichier avec le code bien expliquer enfin à ce que je crois! :)

Merci
 

Pièces jointes

  • test_comparer.zip
    37.1 KB · Affichages: 52

Bebere

XLDnaute Barbatruc
Re : votre aide svp

bonjour Hajar

un début de solution,je reprend ce soir
problème avec sommeprod
j'ai mis une formule en attendant(en e)
le reste est par code(voir module1)
j'ai supprimé cellules fusionnées,fin,etc
ajoute une feuille, nom= feuil1
à bientôt
dans un module
Private Sub TABLEAU_Click()
Dim Rng As Range
Dim Cel As Range, CelD As Range
Dim Col As New Collection
Dim Item As Variant
Dim Plg As Variant, Total As Variant
Dim L As Integer


Application.ScreenUpdating = False

With Sheets("ETAT")
' L = .Range("D65536").End(xlUp).Row
Set Rng = .Range("D16:D" & .Range("D65536").End(xlUp).Row)
End With

For Each Cel In Rng
On Error Resume Next
If Cel <> "" Then
If IsNumeric(Cel) Then Col.Add Cel, CStr(Cel)
End If
On Error GoTo 0

Next Cel

ReDim Plg(1 To Col.Count, 1 To 4)

For Each Item In Col
L = L + 1
Plg(L, 4) = Item
Next Item
'L = 1
For L = 1 To UBound(Plg, 1)
For Each Cel In Rng
'If L > UBound(Plg, 1) Then Exit For
If Cel = Plg(L, 4) Then
Plg(L, 1) = Cel.Offset(0, -3)
Plg(L, 2) = Cel.Offset(0, -2)
Plg(L, 3) = Cel.Offset(0, -1)
'For Each CelD In Rng
'If CelD = Plg(L, 4) Then Plg(L, 5) = Plg(L, 5) + Cel.Offset(0, 1)
'Next CelD
'NB = "SumProduct((IsNumeric(ColD))*(ColD =" & Plg(L, 4) & "),(ColE))"
'Plg(L, 5) = Evaluate("SumProduct((ColD<>"""")*(IsNumeric(ColD))*(ColD =" & Plg(L, 4) & ")*(ColE))")
'Plg(L, 6) = Cel.Offset(0, 2)
Exit For
End If
Next Cel
Next L
Sheets("Feuil1").Range("A1").Resize(UBound(Plg, 1), UBound(Plg, 2)) = Plg
Application.ScreenUpdating = True
End Sub




à bientôt
 

Statistiques des forums

Discussions
312 493
Messages
2 088 949
Membres
103 989
dernier inscrit
jralonso