Bonjour,

j'ai un souci avec ma macro: je tente de faire un test "if" comme condition "1" ou "2" dans une autre feuille du meme classeur.
Le résultat est que cela ne semble pas prendre en compte mon test "if" et me calcule l'ensemble ("1" ou "2" ou "3" ou "4')

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
        For l = 2 To Derling
 
            If Worksheets("caresrpt.cfm-2").Cells(l, 3).Value = 1 Or Worksheets("caresrpt.cfm-2").Cells(l, 3).Value = 2 Then
                Cells(l, 2) = Application.WorksheetFunction.CountIf(Worksheets("caresrpt.cfm-2").Range("Q:Q"), Cells(l, 1))
                Cells(l, 3) = Application.WorksheetFunction.CountIf(Worksheets("caresrpt.cfm-2").Range("X:X"), Cells(l, 1))
 
                Cells(l, 4) = Cells(l, 2) - Cells(l, 3)
            End If
                Cells(2, 5) = Cells(2, 2)
                Cells(2, 6) = Cells(2, 3)
                Cells(2, 7) = Cells(2, 4)
 
                Cells(l + 1, 5) = Cells(l + 1, 2) + Cells(l, 5)
                Cells(l + 1, 6) = Cells(l + 1, 3) + Cells(l, 6)
                Cells(l + 1, 7) = Cells(l + 1, 4) + Cells(l, 7)
 
        Next l
Est ce que mon est est le bon ? j'ai testé en ne mettant que
If Worksheets("caresrpt.cfm-2").Cells(l, 3).Value = 1 Then
=> le résultat est pire ! il ne trouve qu'une seule valeur dans mon tablaeu ...

Merci d'avance pour votre aide,
chris