Err. Compil. Procédure trop Longue
Bon... il fallait bien encore un souci sur mon fichier ... Quand je vois la fin du code arriver enfin...
Alors, je vous joint direct le code original qui est trop long à savoir les IF ELSEIF ELSE.... & en pièce joint un fichier test avec un essai de "compilation de code" infructueux ...
J'ai pas la solution bien que certains parmi vous sont plus que calés pour raccourcir sérieusement....
Alors si vous pouvez encore me partager vos
' DETERMINER LA VALEUR pc1 (colonne A)
If Cells(i, 12) = 1 Then
Set pc1 = Range(Range("S3"), Range("S65536").End(xlUp))
ElseIf Cells(i, 12) = 2 Then
Set pc1 = Range(Range("T3"), Range("T65536").End(xlUp))
ElseIf Cells(i, 12) = 3 Then
Set pc1 = Range(Range("U3"), Range("U65536").End(xlUp))
ElseIf Cells(i, 12) = 4 Then
Set pc1 = Range(Range("V3"), Range("V65536").End(xlUp))
ElseIf Cells(i, 12) = 5 Then
Set pc1 = Range(Range("W3"), Range("W65536").End(xlUp))
ElseIf Cells(i, 12) = 6 Then
Set pc1 = Range(Range("X3"), Range("X65536").End(xlUp))
ElseIf Cells(i, 12) = 7 Then
Set pc1 = Range(Range("Y3"), Range("Y65536").End(xlUp))
ElseIf Cells(i, 12) = 8 Then
Set pc1 = Range(Range("Z3"), Range("Z65536").End(xlUp))
ElseIf Cells(i, 12) = 9 Then
Set pc1 = Range(Range("AA3"), Range("AA65536").End(xlUp))
ElseIf Cells(i, 12) = 10 Then
Set pc1 = Range(Range("AB3"), Range("AB65536").End(xlUp))
ElseIf Cells(i, 12) = 11 Then
Set pc1 = Range(Range("AC3"), Range("AC65536").End(xlUp))
ElseIf Cells(i, 12) = 12 Then
Set pc1 = Range(Range("AD3"), Range("AD65536").End(xlUp))
ElseIf Cells(i, 12) = 13 Then
Set pc1 = Range(Range("AE3"), Range("AE65536").End(xlUp))
ElseIf Cells(i, 12) = 14 Then
Set pc1 = Range(Range("AF3"), Range("AF65536").End(xlUp))
ElseIf Cells(i, 12) = 15 Then
Set pc1 = Range(Range("AG3"), Range("AG65536").End(xlUp))
ElseIf Cells(i, 12) = 16 Then
Set pc1 = Range(Range("AH3"), Range("AH65536").End(xlUp))
ElseIf Cells(i, 12) = 17 Then
Set pc1 = Range(Range("AI3"), Range("AI65536").End(xlUp))
ElseIf Cells(i, 12) = 18 Then
Set pc1 = Range(Range("AJ3"), Range("AJ65536").End(xlUp))
ElseIf Cells(i, 12) = 19 Then
Set pc1 = Range(Range("AK3"), Range("AK65536").End(xlUp))
ElseIf Cells(i, 12) = 20 Then
Set pc1 = Range(Range("AL3"), Range("AL65536").End(xlUp))
ElseIf Cells(i, 12) = 21 Then
Set pc1 = Range(Range("AM3"), Range("AM65536").End(xlUp))
ElseIf Cells(i, 12) = 22 Then
Set pc1 = Range(Range("AN3"), Range("AN65536").End(xlUp))
ElseIf Cells(i, 12) = 23 Then
Set pc1 = Range(Range("AO3"), Range("AO65536").End(xlUp))
ElseIf Cells(i, 12) = 24 Then
Set pc1 = Range(Range("AP3"), Range("AP65536").End(xlUp))
ElseIf Cells(i, 12) = 25 Then
Set pc1 = Range(Range("AQ3"), Range("AQ65536").End(xlUp))
ElseIf Cells(i, 12) = 26 Then
Set pc1 = Range(Range("AR3"), Range("AR65536").End(xlUp))
ElseIf Cells(i, 12) = 27 Then
Set pc1 = Range(Range("AS3"), Range("AS65536").End(xlUp))
ElseIf Cells(i, 12) = 28 Then
Set pc1 = Range(Range("AT3"), Range("AT65536").End(xlUp))
ElseIf Cells(i, 12) = 29 Then
Set pc1 = Range(Range("AU3"), Range("AU65536").End(xlUp))
ElseIf Cells(i, 12) = 30 Then
Set pc1 = Range(Range("AV3"), Range("AV65536").End(xlUp))
ElseIf Cells(i, 12) = 31 Then
Set pc1 = Range(Range("AW3"), Range("AW65536").End(xlUp))
ElseIf Cells(i, 12) = 32 Then
Set pc1 = Range(Range("AX3"), Range("AX65536").End(xlUp))
ElseIf Cells(i, 12) = 33 Then
Set pc1 = Range(Range("AY3"), Range("AY65536").End(xlUp))
ElseIf Cells(i, 12) = 34 Then
Set pc1 = Range(Range("AZ3"), Range("AZ65536").End(xlUp))
ElseIf Cells(i, 12) = 35 Then
Set pc1 = Range(Range("BA3"), Range("BA65536").End(xlUp))
ElseIf Cells(i, 12) = 36 Then
Set pc1 = Range(Range("BB3"), Range("BB65536").End(xlUp))
ElseIf Cells(i, 12) = 37 Then
Set pc1 = Range(Range("BC3"), Range("BC65536").End(xlUp))
ElseIf Cells(i, 12) = 38 Then
Set pc1 = Range(Range("BD3"), Range("BD65536").End(xlUp))
ElseIf Cells(i, 12) = 39 Then
Set pc1 = Range(Range("BE3"), Range("BE65536").End(xlUp))
ElseIf Cells(i, 12) = 40 Then
Set pc1 = Range(Range("BF3"), Range("BF65536").End(xlUp))
ElseIf Cells(i, 12) = 41 Then
Set pc1 = Range(Range("BG3"), Range("BG65536").End(xlUp))
ElseIf Cells(i, 12) = 42 Then
Set pc1 = Range(Range("BH3"), Range("BH65536").End(xlUp))
ElseIf Cells(i, 12) = 43 Then
Set pc1 = Range(Range("BI3"), Range("BI65536").End(xlUp))
ElseIf Cells(i, 12) = 44 Then
Set pc1 = Range(Range("BJ3"), Range("BJ65536").End(xlUp))
ElseIf Cells(i, 12) = 45 Then
Set pc1 = Range(Range("BK3"), Range("BK65536").End(xlUp))
ElseIf Cells(i, 12) = 46 Then
Set pc1 = Range(Range("BL3"), Range("BL65536").End(xlUp))
ElseIf Cells(i, 12) = 47 Then
Set pc1 = Range(Range("BM3"), Range("BM65536").End(xlUp))
ElseIf Cells(i, 12) = 48 Then
Set pc1 = Range(Range("BN3"), Range("BN65536").End(xlUp))
ElseIf Cells(i, 12) = 49 Then
Set pc1 = Range(Range("BO3"), Range("BO65536").End(xlUp))
Else
Set pc1 = Range(Range("BP3"), Range("BP65536").End(xlUp))
End If
' DETERMINER LA VALEUR pc2 (colonne B)
If Cells(i, 13) = 1 Then
Set pc2 = Range(Range("S3"), Range("S65536").End(xlUp))
ElseIf Cells(i, 13) = 2 Then
Set pc2 = Range(Range("T3"), Range("T65536").End(xlUp))
ElseIf Cells(i, 13) = 3 Then
Set pc2 = Range(Range("U3"), Range("U65536").End(xlUp))
ElseIf Cells(i, 13) = 4 Then
Set pc2 = Range(Range("V3"), Range("V65536").End(xlUp))
ElseIf Cells(i, 13) = 5 Then
Set pc2 = Range(Range("W3"), Range("W65536").End(xlUp))
ElseIf Cells(i, 13) = 6 Then
Set pc2 = Range(Range("X3"), Range("X65536").End(xlUp))
ElseIf Cells(i, 13) = 7 Then
Set pc2 = Range(Range("Y3"), Range("Y65536").End(xlUp))
ElseIf Cells(i, 13) = 8 Then
Set pc2 = Range(Range("Z3"), Range("Z65536").End(xlUp))
ElseIf Cells(i, 13) = 9 Then
Set pc2 = Range(Range("AA3"), Range("AA65536").End(xlUp))
ElseIf Cells(i, 13) = 10 Then
Set pc2 = Range(Range("AB3"), Range("AB65536").End(xlUp))
ElseIf Cells(i, 13) = 11 Then
Set pc2 = Range(Range("AC3"), Range("AC65536").End(xlUp))
ElseIf Cells(i, 13) = 12 Then
Set pc2 = Range(Range("AD3"), Range("AD65536").End(xlUp))
ElseIf Cells(i, 13) = 13 Then
Set pc2 = Range(Range("AE3"), Range("AE65536").End(xlUp))
ElseIf Cells(i, 13) = 14 Then
Set pc2 = Range(Range("AF3"), Range("AF65536").End(xlUp))
ElseIf Cells(i, 13) = 15 Then
Set pc2 = Range(Range("AG3"), Range("AG65536").End(xlUp))
ElseIf Cells(i, 13) = 16 Then
Set pc2 = Range(Range("AH3"), Range("AH65536").End(xlUp))
ElseIf Cells(i, 13) = 17 Then
Set pc2 = Range(Range("AI3"), Range("AI65536").End(xlUp))
ElseIf Cells(i, 13) = 18 Then
Set pc2 = Range(Range("AJ3"), Range("AJ65536").End(xlUp))
ElseIf Cells(i, 13) = 19 Then
Set pc2 = Range(Range("AK3"), Range("AK65536").End(xlUp))
ElseIf Cells(i, 13) = 20 Then
Set pc2 = Range(Range("AL3"), Range("AL65536").End(xlUp))
ElseIf Cells(i, 13) = 21 Then
Set pc2 = Range(Range("AM3"), Range("AM65536").End(xlUp))
ElseIf Cells(i, 13) = 22 Then
Set pc2 = Range(Range("AN3"), Range("AN65536").End(xlUp))
ElseIf Cells(i, 13) = 23 Then
Set pc2 = Range(Range("AO3"), Range("AO65536").End(xlUp))
ElseIf Cells(i, 13) = 24 Then
Set pc2 = Range(Range("AP3"), Range("AP65536").End(xlUp))
ElseIf Cells(i, 13) = 25 Then
Set pc2 = Range(Range("AQ3"), Range("AQ65536").End(xlUp))
ElseIf Cells(i, 13) = 26 Then
Set pc2 = Range(Range("AR3"), Range("AR65536").End(xlUp))
ElseIf Cells(i, 13) = 27 Then
Set pc2 = Range(Range("AS3"), Range("AS65536").End(xlUp))
ElseIf Cells(i, 13) = 28 Then
Set pc2 = Range(Range("AT3"), Range("AT65536").End(xlUp))
ElseIf Cells(i, 13) = 29 Then
Set pc2 = Range(Range("AU3"), Range("AU65536").End(xlUp))
ElseIf Cells(i, 13) = 30 Then
Set pc2 = Range(Range("AV3"), Range("AV65536").End(xlUp))
ElseIf Cells(i, 13) = 31 Then
Set pc2 = Range(Range("AW3"), Range("AW65536").End(xlUp))
ElseIf Cells(i, 13) = 32 Then
Set pc2 = Range(Range("AX3"), Range("AX65536").End(xlUp))
ElseIf Cells(i, 13) = 33 Then
Set pc2 = Range(Range("AY3"), Range("AY65536").End(xlUp))
ElseIf Cells(i, 13) = 34 Then
Set pc2 = Range(Range("AZ3"), Range("AZ65536").End(xlUp))
ElseIf Cells(i, 13) = 35 Then
Set pc2 = Range(Range("BA3"), Range("BA65536").End(xlUp))
ElseIf Cells(i, 13) = 36 Then
Set pc2 = Range(Range("BB3"), Range("BB65536").End(xlUp))
ElseIf Cells(i, 13) = 37 Then
Set pc2 = Range(Range("BC3"), Range("BC65536").End(xlUp))
ElseIf Cells(i, 13) = 38 Then
Set pc2 = Range(Range("BD3"), Range("BD65536").End(xlUp))
ElseIf Cells(i, 13) = 39 Then
Set pc2 = Range(Range("BE3"), Range("BE65536").End(xlUp))
ElseIf Cells(i, 13) = 40 Then
Set pc2 = Range(Range("BF3"), Range("BF65536").End(xlUp))
ElseIf Cells(i, 13) = 41 Then
Set pc2 = Range(Range("BG3"), Range("BG65536").End(xlUp))
ElseIf Cells(i, 13) = 42 Then
Set pc2 = Range(Range("BH3"), Range("BH65536").End(xlUp))
ElseIf Cells(i, 13) = 43 Then
Set pc2 = Range(Range("BI3"), Range("BI65536").End(xlUp))
ElseIf Cells(i, 13) = 44 Then
Set pc2 = Range(Range("BJ3"), Range("BJ65536").End(xlUp))
ElseIf Cells(i, 13) = 45 Then
Set pc2 = Range(Range("BK3"), Range("BK65536").End(xlUp))
ElseIf Cells(i, 13) = 46 Then
Set pc2 = Range(Range("BL3"), Range("BL65536").End(xlUp))
ElseIf Cells(i, 13) = 47 Then
Set pc2 = Range(Range("BM3"), Range("BM65536").End(xlUp))
ElseIf Cells(i, 13) = 48 Then
Set pc2 = Range(Range("BN3"), Range("BN65536").End(xlUp))
ElseIf Cells(i, 13) = 49 Then
Set pc2 = Range(Range("BO3"), Range("BO65536").End(xlUp))
Else
Set pc2 = Range(Range("BP3"), Range("BP65536").End(xlUp))
End If
' DETERMINER LA VALEUR pc3 (colonne C)
If Cells(i, 14) = 1 Then
Set pc3 = Range(Range("S3"), Range("S65536").End(xlUp))
ElseIf Cells(i, 14) = 2 Then
Set pc3 = Range(Range("T3"), Range("T65536").End(xlUp))
ElseIf Cells(i, 14) = 3 Then
Set pc3 = Range(Range("U3"), Range("U65536").End(xlUp))
ElseIf Cells(i, 14) = 4 Then
Set pc3 = Range(Range("V3"), Range("V65536").End(xlUp))
ElseIf Cells(i, 14) = 5 Then
Set pc3 = Range(Range("W3"), Range("W65536").End(xlUp))
ElseIf Cells(i, 14) = 6 Then
Set pc3 = Range(Range("X3"), Range("X65536").End(xlUp))
ElseIf Cells(i, 14) = 7 Then
Set pc3 = Range(Range("Y3"), Range("Y65536").End(xlUp))
ElseIf Cells(i, 14) = 8 Then
Set pc3 = Range(Range("Z3"), Range("Z65536").End(xlUp))
ElseIf Cells(i, 14) = 9 Then
Set pc3 = Range(Range("AA3"), Range("AA65536").End(xlUp))
ElseIf Cells(i, 14) = 10 Then
Set pc3 = Range(Range("AB3"), Range("AB65536").End(xlUp))
ElseIf Cells(i, 14) = 11 Then
Set pc3 = Range(Range("AC3"), Range("AC65536").End(xlUp))
ElseIf Cells(i, 14) = 12 Then
Set pc3 = Range(Range("AD3"), Range("AD65536").End(xlUp))
ElseIf Cells(i, 14) = 13 Then
Set pc3 = Range(Range("AE3"), Range("AE65536").End(xlUp))
ElseIf Cells(i, 14) = 14 Then
Set pc3 = Range(Range("AF3"), Range("AF65536").End(xlUp))
ElseIf Cells(i, 14) = 15 Then
Set pc3 = Range(Range("AG3"), Range("AG65536").End(xlUp))
ElseIf Cells(i, 14) = 16 Then
Set pc3 = Range(Range("AH3"), Range("AH65536").End(xlUp))
ElseIf Cells(i, 14) = 17 Then
Set pc3 = Range(Range("AI3"), Range("AI65536").End(xlUp))
ElseIf Cells(i, 14) = 18 Then
Set pc3 = Range(Range("AJ3"), Range("AJ65536").End(xlUp))
ElseIf Cells(i, 14) = 19 Then
Set pc3 = Range(Range("AK3"), Range("AK65536").End(xlUp))
ElseIf Cells(i, 14) = 20 Then
Set pc3 = Range(Range("AL3"), Range("AL65536").End(xlUp))
ElseIf Cells(i, 14) = 21 Then
Set pc3 = Range(Range("AM3"), Range("AM65536").End(xlUp))
ElseIf Cells(i, 14) = 22 Then
Set pc3 = Range(Range("AN3"), Range("AN65536").End(xlUp))
ElseIf Cells(i, 14) = 23 Then
Set pc3 = Range(Range("AO3"), Range("AO65536").End(xlUp))
ElseIf Cells(i, 14) = 24 Then
Set pc3 = Range(Range("AP3"), Range("AP65536").End(xlUp))
ElseIf Cells(i, 14) = 25 Then
Set pc3 = Range(Range("AQ3"), Range("AQ65536").End(xlUp))
ElseIf Cells(i, 14) = 26 Then
Set pc3 = Range(Range("AR3"), Range("AR65536").End(xlUp))
ElseIf Cells(i, 14) = 27 Then
Set pc3 = Range(Range("AS3"), Range("AS65536").End(xlUp))
ElseIf Cells(i, 14) = 28 Then
Set pc3 = Range(Range("AT3"), Range("AT65536").End(xlUp))
ElseIf Cells(i, 14) = 29 Then
Set pc3 = Range(Range("AU3"), Range("AU65536").End(xlUp))
ElseIf Cells(i, 14) = 30 Then
Set pc3 = Range(Range("AV3"), Range("AV65536").End(xlUp))
ElseIf Cells(i, 14) = 31 Then
Set pc3 = Range(Range("AW3"), Range("AW65536").End(xlUp))
ElseIf Cells(i, 14) = 32 Then
Set pc3 = Range(Range("AX3"), Range("AX65536").End(xlUp))
ElseIf Cells(i, 14) = 33 Then
Set pc3 = Range(Range("AY3"), Range("AY65536").End(xlUp))
ElseIf Cells(i, 14) = 34 Then
Set pc3 = Range(Range("AZ3"), Range("AZ65536").End(xlUp))
ElseIf Cells(i, 14) = 35 Then
Set pc3 = Range(Range("BA3"), Range("BA65536").End(xlUp))
ElseIf Cells(i, 14) = 36 Then
Set pc3 = Range(Range("BB3"), Range("BB65536").End(xlUp))
ElseIf Cells(i, 14) = 37 Then
Set pc3 = Range(Range("BC3"), Range("BC65536").End(xlUp))
ElseIf Cells(i, 14) = 38 Then
Set pc3 = Range(Range("BD3"), Range("BD65536").End(xlUp))
ElseIf Cells(i, 14) = 39 Then
Set pc3 = Range(Range("BE3"), Range("BE65536").End(xlUp))
ElseIf Cells(i, 14) = 40 Then
Set pc3 = Range(Range("BF3"), Range("BF65536").End(xlUp))
ElseIf Cells(i, 14) = 41 Then
Set pc3 = Range(Range("BG3"), Range("BG65536").End(xlUp))
ElseIf Cells(i, 14) = 42 Then
Set pc3 = Range(Range("BH3"), Range("BH65536").End(xlUp))
ElseIf Cells(i, 14) = 43 Then
Set pc3 = Range(Range("BI3"), Range("BI65536").End(xlUp))
ElseIf Cells(i, 14) = 44 Then
Set pc3 = Range(Range("BJ3"), Range("BJ65536").End(xlUp))
ElseIf Cells(i, 14) = 45 Then
Set pc3 = Range(Range("BK3"), Range("BK65536").End(xlUp))
ElseIf Cells(i, 14) = 46 Then
Set pc3 = Range(Range("BL3"), Range("BL65536").End(xlUp))
ElseIf Cells(i, 14) = 47 Then
Set pc3 = Range(Range("BM3"), Range("BM65536").End(xlUp))
ElseIf Cells(i, 14) = 48 Then
Set pc3 = Range(Range("BN3"), Range("BN65536").End(xlUp))
ElseIf Cells(i, 14) = 49 Then
Set pc3 = Range(Range("BO3"), Range("BO65536").End(xlUp))
Else
Set pc3 = Range(Range("BP3"), Range("BP65536").End(xlUp))
End If
' DETERMINER LA VALEUR pc4 (colonne D)
If Cells(i, 15) = 1 Then
Set pc4 = Range(Range("S3"), Range("S65536").End(xlUp))
ElseIf Cells(i, 15) = 2 Then
Set pc4 = Range(Range("T3"), Range("T65536").End(xlUp))
ElseIf Cells(i, 15) = 3 Then
Set pc4 = Range(Range("U3"), Range("U65536").End(xlUp))
ElseIf Cells(i, 15) = 4 Then
Set pc4 = Range(Range("V3"), Range("V65536").End(xlUp))
ElseIf Cells(i, 15) = 5 Then
Set pc4 = Range(Range("W3"), Range("W65536").End(xlUp))
ElseIf Cells(i, 15) = 6 Then
Set pc4 = Range(Range("X3"), Range("X65536").End(xlUp))
ElseIf Cells(i, 15) = 7 Then
Set pc4 = Range(Range("Y3"), Range("Y65536").End(xlUp))
ElseIf Cells(i, 15) = 8 Then
Set pc4 = Range(Range("Z3"), Range("Z65536").End(xlUp))
ElseIf Cells(i, 15) = 9 Then
Set pc4 = Range(Range("AA3"), Range("AA65536").End(xlUp))
ElseIf Cells(i, 15) = 10 Then
Set pc4 = Range(Range("AB3"), Range("AB65536").End(xlUp))
ElseIf Cells(i, 15) = 11 Then
Set pc4 = Range(Range("AC3"), Range("AC65536").End(xlUp))
ElseIf Cells(i, 15) = 12 Then
Set pc4 = Range(Range("AD3"), Range("AD65536").End(xlUp))
ElseIf Cells(i, 15) = 13 Then
Set pc4 = Range(Range("AE3"), Range("AE65536").End(xlUp))
ElseIf Cells(i, 15) = 14 Then
Set pc4 = Range(Range("AF3"), Range("AF65536").End(xlUp))
ElseIf Cells(i, 15) = 15 Then
Set pc4 = Range(Range("AG3"), Range("AG65536").End(xlUp))
ElseIf Cells(i, 15) = 16 Then
Set pc4 = Range(Range("AH3"), Range("AH65536").End(xlUp))
ElseIf Cells(i, 15) = 17 Then
Set pc4 = Range(Range("AI3"), Range("AI65536").End(xlUp))
ElseIf Cells(i, 15) = 18 Then
Set pc4 = Range(Range("AJ3"), Range("AJ65536").End(xlUp))
ElseIf Cells(i, 15) = 19 Then
Set pc4 = Range(Range("AK3"), Range("AK65536").End(xlUp))
ElseIf Cells(i, 15) = 20 Then
Set pc4 = Range(Range("AL3"), Range("AL65536").End(xlUp))
ElseIf Cells(i, 15) = 21 Then
Set pc4 = Range(Range("AM3"), Range("AM65536").End(xlUp))
ElseIf Cells(i, 15) = 22 Then
Set pc4 = Range(Range("AN3"), Range("AN65536").End(xlUp))
ElseIf Cells(i, 15) = 23 Then
Set pc4 = Range(Range("AO3"), Range("AO65536").End(xlUp))
ElseIf Cells(i, 15) = 24 Then
Set pc4 = Range(Range("AP3"), Range("AP65536").End(xlUp))
ElseIf Cells(i, 15) = 25 Then
Set pc4 = Range(Range("AQ3"), Range("AQ65536").End(xlUp))
ElseIf Cells(i, 15) = 26 Then
Set pc4 = Range(Range("AR3"), Range("AR65536").End(xlUp))
ElseIf Cells(i, 15) = 27 Then
Set pc4 = Range(Range("AS3"), Range("AS65536").End(xlUp))
ElseIf Cells(i, 15) = 28 Then
Set pc4 = Range(Range("AT3"), Range("AT65536").End(xlUp))
ElseIf Cells(i, 15) = 29 Then
Set pc4 = Range(Range("AU3"), Range("AU65536").End(xlUp))
ElseIf Cells(i, 15) = 30 Then
Set pc4 = Range(Range("AV3"), Range("AV65536").End(xlUp))
ElseIf Cells(i, 15) = 31 Then
Set pc4 = Range(Range("AW3"), Range("AW65536").End(xlUp))
ElseIf Cells(i, 15) = 32 Then
Set pc4 = Range(Range("AX3"), Range("AX65536").End(xlUp))
ElseIf Cells(i, 15) = 33 Then
Set pc4 = Range(Range("AY3"), Range("AY65536").End(xlUp))
ElseIf Cells(i, 15) = 34 Then
Set pc4 = Range(Range("AZ3"), Range("AZ65536").End(xlUp))
ElseIf Cells(i, 15) = 35 Then
Set pc4 = Range(Range("BA3"), Range("BA65536").End(xlUp))
ElseIf Cells(i, 15) = 36 Then
Set pc4 = Range(Range("BB3"), Range("BB65536").End(xlUp))
ElseIf Cells(i, 15) = 37 Then
Set pc4 = Range(Range("BC3"), Range("BC65536").End(xlUp))
ElseIf Cells(i, 15) = 38 Then
Set pc4 = Range(Range("BD3"), Range("BD65536").End(xlUp))
ElseIf Cells(i, 15) = 39 Then
Set pc4 = Range(Range("BE3"), Range("BE65536").End(xlUp))
ElseIf Cells(i, 15) = 40 Then
Set pc4 = Range(Range("BF3"), Range("BF65536").End(xlUp))
ElseIf Cells(i, 15) = 41 Then
Set pc4 = Range(Range("BG3"), Range("BG65536").End(xlUp))
ElseIf Cells(i, 15) = 42 Then
Set pc4 = Range(Range("BH3"), Range("BH65536").End(xlUp))
ElseIf Cells(i, 15) = 43 Then
Set pc4 = Range(Range("BI3"), Range("BI65536").End(xlUp))
ElseIf Cells(i, 15) = 44 Then
Set pc4 = Range(Range("BJ3"), Range("BJ65536").End(xlUp))
ElseIf Cells(i, 15) = 45 Then
Set pc4 = Range(Range("BK3"), Range("BK65536").End(xlUp))
ElseIf Cells(i, 15) = 46 Then
Set pc4 = Range(Range("BL3"), Range("BL65536").End(xlUp))
ElseIf Cells(i, 15) = 47 Then
Set pc4 = Range(Range("BM3"), Range("BM65536").End(xlUp))
ElseIf Cells(i, 15) = 48 Then
Set pc4 = Range(Range("BN3"), Range("BN65536").End(xlUp))
ElseIf Cells(i, 15) = 49 Then
Set pc4 = Range(Range("BO3"), Range("BO65536").End(xlUp))
Else
Set pc4 = Range(Range("BP3"), Range("BP65536").End(xlUp))
End If
' DETERMINER LA VALEUR pc5 (colonne E)
If Cells(i, 16) = 1 Then
Set pc5 = Range(Range("S3"), Range("S65536").End(xlUp))
ElseIf Cells(i, 16) = 2 Then
Set pc5 = Range(Range("T3"), Range("T65536").End(xlUp))
ElseIf Cells(i, 16) = 3 Then
Set pc5 = Range(Range("U3"), Range("U65536").End(xlUp))
ElseIf Cells(i, 16) = 4 Then
Set pc5 = Range(Range("V3"), Range("V65536").End(xlUp))
ElseIf Cells(i, 16) = 5 Then
Set pc5 = Range(Range("W3"), Range("W65536").End(xlUp))
ElseIf Cells(i, 16) = 6 Then
Set pc5 = Range(Range("X3"), Range("X65536").End(xlUp))
ElseIf Cells(i, 16) = 7 Then
Set pc5 = Range(Range("Y3"), Range("Y65536").End(xlUp))
ElseIf Cells(i, 16) = 8 Then
Set pc5 = Range(Range("Z3"), Range("Z65536").End(xlUp))
ElseIf Cells(i, 16) = 9 Then
Set pc5 = Range(Range("AA3"), Range("AA65536").End(xlUp))
ElseIf Cells(i, 16) = 10 Then
Set pc5 = Range(Range("AB3"), Range("AB65536").End(xlUp))
ElseIf Cells(i, 16) = 11 Then
Set pc5 = Range(Range("AC3"), Range("AC65536").End(xlUp))
ElseIf Cells(i, 16) = 12 Then
Set pc5 = Range(Range("AD3"), Range("AD65536").End(xlUp))
ElseIf Cells(i, 16) = 13 Then
Set pc5 = Range(Range("AE3"), Range("AE65536").End(xlUp))
ElseIf Cells(i, 16) = 14 Then
Set pc5 = Range(Range("AF3"), Range("AF65536").End(xlUp))
ElseIf Cells(i, 16) = 15 Then
Set pc5 = Range(Range("AG3"), Range("AG65536").End(xlUp))
ElseIf Cells(i, 16) = 16 Then
Set pc5 = Range(Range("AH3"), Range("AH65536").End(xlUp))
ElseIf Cells(i, 16) = 17 Then
Set pc5 = Range(Range("AI3"), Range("AI65536").End(xlUp))
ElseIf Cells(i, 16) = 18 Then
Set pc5 = Range(Range("AJ3"), Range("AJ65536").End(xlUp))
ElseIf Cells(i, 16) = 19 Then
Set pc5 = Range(Range("AK3"), Range("AK65536").End(xlUp))
ElseIf Cells(i, 16) = 20 Then
Set pc5 = Range(Range("AL3"), Range("AL65536").End(xlUp))
ElseIf Cells(i, 16) = 21 Then
Set pc5 = Range(Range("AM3"), Range("AM65536").End(xlUp))
ElseIf Cells(i, 16) = 22 Then
Set pc5 = Range(Range("AN3"), Range("AN65536").End(xlUp))
ElseIf Cells(i, 16) = 23 Then
Set pc5 = Range(Range("AO3"), Range("AO65536").End(xlUp))
ElseIf Cells(i, 16) = 24 Then
Set pc5 = Range(Range("AP3"), Range("AP65536").End(xlUp))
ElseIf Cells(i, 16) = 25 Then
Set pc5 = Range(Range("AQ3"), Range("AQ65536").End(xlUp))
ElseIf Cells(i, 16) = 26 Then
Set pc5 = Range(Range("AR3"), Range("AR65536").End(xlUp))
ElseIf Cells(i, 16) = 27 Then
Set pc5 = Range(Range("AS3"), Range("AS65536").End(xlUp))
ElseIf Cells(i, 16) = 28 Then
Set pc5 = Range(Range("AT3"), Range("AT65536").End(xlUp))
ElseIf Cells(i, 16) = 29 Then
Set pc5 = Range(Range("AU3"), Range("AU65536").End(xlUp))
ElseIf Cells(i, 16) = 30 Then
Set pc5 = Range(Range("AV3"), Range("AV65536").End(xlUp))
ElseIf Cells(i, 16) = 31 Then
Set pc5 = Range(Range("AW3"), Range("AW65536").End(xlUp))
ElseIf Cells(i, 16) = 32 Then
Set pc5 = Range(Range("AX3"), Range("AX65536").End(xlUp))
ElseIf Cells(i, 16) = 33 Then
Set pc5 = Range(Range("AY3"), Range("AY65536").End(xlUp))
ElseIf Cells(i, 16) = 34 Then
Set pc5 = Range(Range("AZ3"), Range("AZ65536").End(xlUp))
ElseIf Cells(i, 16) = 35 Then
Set pc5 = Range(Range("BA3"), Range("BA65536").End(xlUp))
ElseIf Cells(i, 16) = 36 Then
Set pc5 = Range(Range("BB3"), Range("BB65536").End(xlUp))
ElseIf Cells(i, 16) = 37 Then
Set pc5 = Range(Range("BC3"), Range("BC65536").End(xlUp))
ElseIf Cells(i, 16) = 38 Then
Set pc5 = Range(Range("BD3"), Range("BD65536").End(xlUp))
ElseIf Cells(i, 16) = 39 Then
Set pc5 = Range(Range("BE3"), Range("BE65536").End(xlUp))
ElseIf Cells(i, 16) = 40 Then
Set pc5 = Range(Range("BF3"), Range("BF65536").End(xlUp))
ElseIf Cells(i, 16) = 41 Then
Set pc5 = Range(Range("BG3"), Range("BG65536").End(xlUp))
ElseIf Cells(i, 16) = 42 Then
Set pc5 = Range(Range("BH3"), Range("BH65536").End(xlUp))
ElseIf Cells(i, 16) = 43 Then
Set pc5 = Range(Range("BI3"), Range("BI65536").End(xlUp))
ElseIf Cells(i, 16) = 44 Then
Set pc5 = Range(Range("BJ3"), Range("BJ65536").End(xlUp))
ElseIf Cells(i, 16) = 45 Then
Set pc5 = Range(Range("BK3"), Range("BK65536").End(xlUp))
ElseIf Cells(i, 16) = 46 Then
Set pc5 = Range(Range("BL3"), Range("BL65536").End(xlUp))
ElseIf Cells(i, 16) = 47 Then
Set pc5 = Range(Range("BM3"), Range("BM65536").End(xlUp))
ElseIf Cells(i, 16) = 48 Then
Set pc5 = Range(Range("BN3"), Range("BN65536").End(xlUp))
ElseIf Cells(i, 16) = 49 Then
Set pc5 = Range(Range("BO3"), Range("BO65536").End(xlUp))
Else
Set pc5 = Range(Range("BP3"), Range("BP65536").End(xlUp))
End If
'CALCUL A+B+C+D+E ensemble sous condition 1/0 qui varient
var1 = Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 1, pc3, 1, pc4, 1, pc5, 1)
var2 = Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 1, pc3, 1, pc4, 1, pc5, 0) + _
Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 1, pc3, 1, pc4, 0, pc5, 1) + _
Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 1, pc3, 0, pc4, 1, pc5, 1) + _
Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 0, pc3, 1, pc4, 1, pc5, 1) + _
Application.WorksheetFunction.CountIfs(pc1, 0, pc2, 1, pc3, 1, pc4, 1, pc5, 1)
var3 = Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 1, pc3, 1, pc4, 0, pc5, 0) + _
Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 1, pc3, 0, pc4, 1, pc5, 0) + _
Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 1, pc3, 0, pc4, 0, pc5, 1) + _
Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 0, pc3, 1, pc4, 1, pc5, 0) + _
Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 0, pc3, 1, pc4, 0, pc5, 1) + _
Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 0, pc3, 0, pc4, 1, pc5, 1) + _
Application.WorksheetFunction.CountIfs(pc1, 0, pc2, 1, pc3, 1, pc4, 1, pc5, 0) + _
Application.WorksheetFunction.CountIfs(pc1, 0, pc2, 1, pc3, 1, pc4, 0, pc5, 1) + _
Application.WorksheetFunction.CountIfs(pc1, 0, pc2, 1, pc3, 0, pc4, 1, pc5, 1) + _
Application.WorksheetFunction.CountIfs(pc1, 0, pc2, 0, pc3, 1, pc4, 1, pc5, 1)
var4 = Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 1, pc3, 0, pc4, 0, pc5, 0) + _
Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 0, pc3, 1, pc4, 0, pc5, 0) + _
Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 0, pc3, 0, pc4, 1, pc5, 0) + _
Application.WorksheetFunction.CountIfs(pc1, 1, pc2, 0, pc3, 0, pc4, 0, pc5, 1) + _
Application.WorksheetFunction.CountIfs(pc1, 0, pc2, 1, pc3, 1, pc4, 0, pc5, 0) + _
Application.WorksheetFunction.CountIfs(pc1, 0, pc2, 1, pc3, 0, pc4, 1, pc5, 0) + _
Application.WorksheetFunction.CountIfs(pc1, 0, pc2, 1, pc3, 0, pc4, 0, pc5, 1) + _
Application.WorksheetFunction.CountIfs(pc1, 0, pc2, 0, pc3, 1, pc4, 1, pc5, 0) + _
Application.WorksheetFunction.CountIfs(pc1, 0, pc2, 0, pc3, 1, pc4, 0, pc5, 1) + _
Application.WorksheetFunction.CountIfs(pc1, 0, pc2, 0, pc3, 0, pc4, 1, pc5, 1)
For Each Cell in pd1
Cell.Value = var1 + var2 + var3 + var4
Next Cell
Lilly
Avant d'améliorer ton code ...
Pour commencer ... Tu devrais essayer ... Select Case ... pour remplacer ton If ....
Et je te rassure ... il existe plein d'autres pistes ...
Bonjour, pardonnez moi si je suis à côté de la plaque mais quand j'ai ouvert le fichier, j'ai crié très fort car je n'ai rien compris
ceci dit, pour le premier tronçon vais-je dire, je pense que ceci peut être une première base de travail en terme de boucle et de simplification. Cependant, n'ayant rien compris au fichier, peut-être que je me trompe
Dim il As Integer, icol As Integer
For icol = 19 To 50
For il = 1 To 49
If Cells(i, 12) = il Then
Set pc1 = Range(Cells(3, icol), Cells(65536, icol).End(xlUp))
End If
Next il
Next icol
ou alors comme ça peut-être !
Dim il As Integer, icol As Integer
icol = 19
For il = 1 To 49
If Cells(i, 12) = il Then
Set pc1 = Range(Cells(3, icol), Cells(65536, icol).End(xlUp))
End If
icol = icol + 1
Next il
Bonjour,
edit : effacé, j'avais pas vu le nombre de colonnes effectives.
Re,
Quelqu'un peut me dire le nombre d'arguments que peut prendre la fonction 'Choose'?
Cela permettrait d'éviter les boucles, select case, etc...
Merci par avance.
Cdlt.
Salut Jean -Eric
A priori, pour les fonctions (depuis Excel 2007) ... le nombre d'arguments maximal est de 255 ...
Par contre, la limite atteinte par le code de Lilly est sans doute celle de 64 K ... pour une procédure ...
Pour éviter son problème, il existe beaucoup de pistes possibles ... notamment des UDFs ...
En fait je me retrouve avec le même souci qu'avant là....
sauf qu'au lieu que ce soit les calculs qui plantent le fichier...
Là le code est trop long....
J'ai vu sur le forum qu'on peut fractionner le code....
j'ai pensé faire d'autre sub et les appeler dans celle-ci... je crois que c'est en utilisant "CALL" mais j'ai pas tout compris....
J'ai aussi vu des codes fait par Bonzaï et Galopin (entre autre...) super compact pour des choix aussi long et là aussi j'ai rien compris.... cependant vu que c'est toujours la même chose dupliquer 6 fois... je me suis dit qu'il doit y avoir un moyen de condenser...
c'est ce que j'ai essayé avec SELECT CASE cependant je sais pas comment faire pour écrire les 50 lignes une seule fois et que cela se fasse pour mes 6 fois.... sachant que j'utilise les 6 résultats pour divers calculs COUNTIFS.... qui eux aussi sont un peu long....
je suis pas très calée... Alors j'ai besoin de bien comprendre.... l'exemple de code 1 mis....
Icol fait référence au nombre de possibilité de colonne si j'ai bien compris
et Il à la valeur que peut avoir la cellule (1,12) par exemple ....
Si c'est ça alors cela raccourci énorme....
Mais après je vois pas où le placer pour utiliser le résultat pour mes calculs....
Pourrais-tu s'il te plait me donner l'adresse d'un tuto autre que celui fourni par microsoft pour la fonction CHOOSE ?.... parce que leurs tuto, je suis pas assez calée pour comprendre leur langage réservé aux pros.... et les traductions sont parfois "hasardeuses"...
Ben avant d'être en vba j'avais 50 fichiers de 30000 Ko chaque ( 1 fichier par article) + 2 fichiers récap aussi lourd.... pour faire le même travail mais sans aucune macro....
D'où le passage au vba... c'est quand même agréable que le travail se fasse en 5 mn au lieu de 10 h....
Quoiqu'il en soit
les boucles servent à ' DETERMINER LA VALEUR pc1 et simplement pc1. vous supprimez tout ça :
' DETERMINER LA VALEUR pc1 (colonne A)
If Cells(i, 12) = 1 Then
Set pc1 = Range(Range("S3"), Range("S65536").End(xlUp))
ElseIf Cells(i, 12) = 2 Then
Set pc1 = Range(Range("T3"), Range("T65536").End(xlUp))
ElseIf Cells(i, 12) = 3 Then
Set pc1 = Range(Range("U3"), Range("U65536").End(xlUp))
ElseIf Cells(i, 12) = 4 Then
Set pc1 = Range(Range("V3"), Range("V65536").End(xlUp))
ElseIf Cells(i, 12) = 5 Then
Set pc1 = Range(Range("W3"), Range("W65536").End(xlUp))
ElseIf Cells(i, 12) = 6 Then
Set pc1 = Range(Range("X3"), Range("X65536").End(xlUp))
ElseIf Cells(i, 12) = 7 Then
Set pc1 = Range(Range("Y3"), Range("Y65536").End(xlUp))
ElseIf Cells(i, 12) = 8 Then
Set pc1 = Range(Range("Z3"), Range("Z65536").End(xlUp))
ElseIf Cells(i, 12) = 9 Then
Set pc1 = Range(Range("AA3"), Range("AA65536").End(xlUp))
ElseIf Cells(i, 12) = 10 Then
Set pc1 = Range(Range("AB3"), Range("AB65536").End(xlUp))
ElseIf Cells(i, 12) = 11 Then
Set pc1 = Range(Range("AC3"), Range("AC65536").End(xlUp))
ElseIf Cells(i, 12) = 12 Then
Set pc1 = Range(Range("AD3"), Range("AD65536").End(xlUp))
ElseIf Cells(i, 12) = 13 Then
Set pc1 = Range(Range("AE3"), Range("AE65536").End(xlUp))
ElseIf Cells(i, 12) = 14 Then
Set pc1 = Range(Range("AF3"), Range("AF65536").End(xlUp))
ElseIf Cells(i, 12) = 15 Then
Set pc1 = Range(Range("AG3"), Range("AG65536").End(xlUp))
ElseIf Cells(i, 12) = 16 Then
Set pc1 = Range(Range("AH3"), Range("AH65536").End(xlUp))
ElseIf Cells(i, 12) = 17 Then
Set pc1 = Range(Range("AI3"), Range("AI65536").End(xlUp))
ElseIf Cells(i, 12) = 18 Then
Set pc1 = Range(Range("AJ3"), Range("AJ65536").End(xlUp))
ElseIf Cells(i, 12) = 19 Then
Set pc1 = Range(Range("AK3"), Range("AK65536").End(xlUp))
ElseIf Cells(i, 12) = 20 Then
Set pc1 = Range(Range("AL3"), Range("AL65536").End(xlUp))
ElseIf Cells(i, 12) = 21 Then
Set pc1 = Range(Range("AM3"), Range("AM65536").End(xlUp))
ElseIf Cells(i, 12) = 22 Then
Set pc1 = Range(Range("AN3"), Range("AN65536").End(xlUp))
ElseIf Cells(i, 12) = 23 Then
Set pc1 = Range(Range("AO3"), Range("AO65536").End(xlUp))
ElseIf Cells(i, 12) = 24 Then
Set pc1 = Range(Range("AP3"), Range("AP65536").End(xlUp))
ElseIf Cells(i, 12) = 25 Then
Set pc1 = Range(Range("AQ3"), Range("AQ65536").End(xlUp))
ElseIf Cells(i, 12) = 26 Then
Set pc1 = Range(Range("AR3"), Range("AR65536").End(xlUp))
ElseIf Cells(i, 12) = 27 Then
Set pc1 = Range(Range("AS3"), Range("AS65536").End(xlUp))
ElseIf Cells(i, 12) = 28 Then
Set pc1 = Range(Range("AT3"), Range("AT65536").End(xlUp))
ElseIf Cells(i, 12) = 29 Then
Set pc1 = Range(Range("AU3"), Range("AU65536").End(xlUp))
ElseIf Cells(i, 12) = 30 Then
Set pc1 = Range(Range("AV3"), Range("AV65536").End(xlUp))
ElseIf Cells(i, 12) = 31 Then
Set pc1 = Range(Range("AW3"), Range("AW65536").End(xlUp))
ElseIf Cells(i, 12) = 32 Then
Set pc1 = Range(Range("AX3"), Range("AX65536").End(xlUp))
ElseIf Cells(i, 12) = 33 Then
Set pc1 = Range(Range("AY3"), Range("AY65536").End(xlUp))
ElseIf Cells(i, 12) = 34 Then
Set pc1 = Range(Range("AZ3"), Range("AZ65536").End(xlUp))
ElseIf Cells(i, 12) = 35 Then
Set pc1 = Range(Range("BA3"), Range("BA65536").End(xlUp))
ElseIf Cells(i, 12) = 36 Then
Set pc1 = Range(Range("BB3"), Range("BB65536").End(xlUp))
ElseIf Cells(i, 12) = 37 Then
Set pc1 = Range(Range("BC3"), Range("BC65536").End(xlUp))
ElseIf Cells(i, 12) = 38 Then
Set pc1 = Range(Range("BD3"), Range("BD65536").End(xlUp))
ElseIf Cells(i, 12) = 39 Then
Set pc1 = Range(Range("BE3"), Range("BE65536").End(xlUp))
ElseIf Cells(i, 12) = 40 Then
Set pc1 = Range(Range("BF3"), Range("BF65536").End(xlUp))
ElseIf Cells(i, 12) = 41 Then
Set pc1 = Range(Range("BG3"), Range("BG65536").End(xlUp))
ElseIf Cells(i, 12) = 42 Then
Set pc1 = Range(Range("BH3"), Range("BH65536").End(xlUp))
ElseIf Cells(i, 12) = 43 Then
Set pc1 = Range(Range("BI3"), Range("BI65536").End(xlUp))
ElseIf Cells(i, 12) = 44 Then
Set pc1 = Range(Range("BJ3"), Range("BJ65536").End(xlUp))
ElseIf Cells(i, 12) = 45 Then
Set pc1 = Range(Range("BK3"), Range("BK65536").End(xlUp))
ElseIf Cells(i, 12) = 46 Then
Set pc1 = Range(Range("BL3"), Range("BL65536").End(xlUp))
ElseIf Cells(i, 12) = 47 Then
Set pc1 = Range(Range("BM3"), Range("BM65536").End(xlUp))
ElseIf Cells(i, 12) = 48 Then
Set pc1 = Range(Range("BN3"), Range("BN65536").End(xlUp))
ElseIf Cells(i, 12) = 49 Then
Set pc1 = Range(Range("BO3"), Range("BO65536").End(xlUp))
et vous ne gardez que la dernière occurence
Else
Set pc1 = Range(Range("BP3"), Range("BP65536").End(xlUp))
End If
Oui icol c'est pour les colonnes, vous analysez les mêmes donc boucler reste une logique d'execution à ne pas négliger
Merci pour l'explication...
Donc je vais faire mes 6 boucles comme vous l'avez suggéré sans les fermer puis le calcul pour ma colonne puis fermer les boucles ...
Et je vais tester...
Si cela fonctionne aussi bien que je le suppose
car je pense que je ne dois pas être la seule à qui ce type de soucis arrive...
En attendant, je vous souhaite une excellente journée et encore
Je joint le fichier modifier avec la proposition de Frédéric....
Mais j'ai du vraiment mal comprendre et j'ai encore du m'y prendre de façon non logique....
car j'ai le message d'erreur suivant :
"Erreur d'exécution 1004 : Impossible de lire la propriétés Countifs de la classe WorksheetFunction"
Bon je vois joint le fichier test...
Merci encore pour toute l'aide apportée.
me suis trompée de fichier....
c'est celui de ce message qu'il faut prendre....
je veux dire le TEST PLAGE V2.XLSM
Bonjour à tous,
Par simple acquis de conscience ... ne s'agit-il pas du même problème que celui qui a été solutionné ...pour les Countifs() ... ???
dans ce fil ...https://forum.excel-pratique.com/post334237.html#p334237
Je pense avoir trouvé une solution si le but est d'additionner tous les 1 des articles dont le numéro figure dans A3:E15
Sub test()
Dim compteur As Integer, cherche As Range
Dim dl As Long
Dim icol As Byte, il As Byte
compteur = 0
dl = Sheets("vte valou").Range("a" & Rows.Count).End(xlUp).Row
For il = 3 To dl
For icol = 1 To 5
With Sheets("vte valou").Range("h2:BE2")
Set cherche = .Find(Sheets("vte valou").Cells(il, icol))
If Not cherche Is Nothing Then
Range(cherche.Offset(1, 0), cherche.Offset(25, 0)).Select
compteur = compteur + Application.WorksheetFunction.Sum(Selection)
End If
End With
Next icol
Next il
MsgBox compteur
End Sub
ceci dit cela me parait tellement évident que je doute
ha non... pas du tout...
Là les 5 premières colonnes sont la résultante du travail précédent... réussi grâce à toi ...
Les autres colonnes concernent 1 personne particulière et les articles qu'elle vend sur son secteur...
si tu veux : les colonnes ABCDE . On peut dire que c'est un tableau nommé "top ventes des lots" (merci encore
les colonnes H à BE sont les ventes réalisées par Valou depuis son entrée dans l'association. on peut dire que c'est un autre tableau nommé "vente Valou" où il y a une ligne par jour de travail et où chaque colonne représente si oui ou non elle a vendu cet article précis ce jour là.... C'est pour cela que j'ai choisi pour chaque colonne une plage dynamique... vu que les filles ont pas toutes commencées à la même date... j'ai un nombre de ligne variable...
Tu peux constater que contrairement à l'exemple que tu cites là il n'y a pas de lien direct entre les 2 "tableaux"....
Sinon tu penses bien que j'aurai utilisé le code donné précédemment et qui fait des miracles
Le but : obtenir dans la colonne BF le total par lot (c'est à dire par ligne, vis à vis des 5 premières colonnes uniquement ) où la personne a vendu les 5 articles du lot le même jour (la var1 dans le code), 4/5 articles du lot le même jour (la var2dans le code), 3/5 articles du lot le même jour (la var3 dans le code) et 2/5 articles du lot le même jour (la var4 dans le code)....
Afin de lui fournir seulement les lots qu'elle écoule le plus et de dispatcher ceux qu'elle vend pas chez celles qui en vendent...
Dans le test que j'ai fait au départ avec le code, j'avais fait avec 10 articles au lieu de 50... avec les IF ELSEIF ELSE pour le choix de la colonne à prendre en compte comme pc1 pc2 pc3 pc4 pc5 pour les calculs des variables var1 à var4
Cela fonctionnait à merveille....
Alors je sais bien que le burn out a réduit mon QI de 146 à un Qi de "bulot"...
C'est pour ça aussi que je me suis réjouie de la piste donnée par Frédéric... mais encore une fois, je ne peux que constater que le burn out a eu des effets désastreux sur mes facultés de compréhension... et la pilule passe plutôt mal même si je dit en riant "blonde attitude"
Ais-je répondu à ton questionnement ?
la finalité du fichier me plait donc je vais quand même continuer de me tordre les neurones avec cette fois-ci une meilleur compréhension sans pour autant être sur de réussir
Presque cela.....
Je cherche à additionner dans la colonne BF les résultantes des var1, var2, var3, var4 de la procédure pour Valou
les colonnes H à BE c'est la liste totale des articles
les lignes H à BE sont les ventes réalisées par Valou : 1 jour = 1 ligne... si la valeur est 0 article non vendu. si la valeur est 1 article vendu.
Bon dans l'exemple j'ai mis par ligne que 5 articles avec la valeur 1 pour pouvoir vérifier facilement les calculs des variables... mais il y en a beaucoup plus en fait en réel.
Donc je cherche à définir par rapport au lot top (colonne A à E) :
Dans le tableau de Valou (colonne H à BE) combien de fois :
var 1 : 5 articles du lot vendus ensembles (pc1 à pc5 =1)
var 2 : 4/5 articles du lot vendus ensembles (toutes les combinaison avec l'un des pc =0)
var 3 : 3/5 articles du lot vendus ensembles (toutes les combinaison avec 2 des pc =0)
var 4 : 2/5 articles du lot vendus ensembles (toutes les combinaison avec 3 des pc =0)
puis je fais dans la colonne BF l'addition de var1, var2, var3, var4.....
Tout comme pour James...
Re Frédéric
Je dois me rendre d'urgence à l'hôpital .... je ne pourrais probablement pas regarder aujourd'hui... mais que demain...
Encore merci pour ton aide...
Belle fin de journée
Annule et remplace mon précédent post, les variables var1,var2 s'affichent par défaut sur l'onglet synthèse.
Je vois enfin le bout du tunnel....
Merci Frédéric pour le code... Du coup grâce à la feuille synthèse j'ai déjà le tableau que je devait créer ensuite pour toutes les filles... donc 1000
Juste un Bémol (c'est pas grave je vais faire avec...
Bon sinon actuellement, j'ai trouvé une autre solution avec mon code à rallonge... Là,
Je remets en pièce jointe le code à rallonge qui tourne....
Pour celui de Frédéric...
Bon aussi, grâce à une interrogation d'une autre personne... Je me suis aussi aperçue qu'il serait mieux d'avoir le même nombre de ligne pour toutes les filles... en mettant à zéro les jours qui sont antérieurs à leur premier jours de travail... ce qui me permet aussi d'utiliser judicieusement la feuille créer par Frédéric... moins de travail en perspective et plus de
Alors encore une fois
Je vais mettre que le sujet est clos (...même avec le mini souci de la ligne 3...)
Je vous souhaite à tous du fond du coeur une excellente journée...
Au plaisir de vous recroiser ici...
Je suis confu que cela ne marche pas...Désolé