Bonjour à tous,

Voila dans le cadre d'un projet j'ai créé le code ci-dessous. Cela fonctionne a une exception près pour le moment. Dans le cas où je rentre dans la boucle if Cells(j,i)=Cells(k,30) pour la première rentrée, si je tente de faire 1+1, le résultat devient 11 au lieu de 2 comme vous le savez. En revanche, si je fais 1+1+1, cela me fait 12. Donc la deuxième itération, il me calcule bien 11+1. Le problème semble se situer à la première itération.
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
19
20
21
22
23
24
25
26
27
28
Sub MacroAnalysedata()
    ActiveSheet.Range("$A$6:$Z$406").AutoFilter Field:=2
    Dim DernLigne As Long
    Dim l As Long
    For i = 3 To 26
    l = 0
        For j = 9 To 406 Step 5
            If Cells(j, i) = "" Then
                Exit For
           Else
                For k = 8 To 87
                    If Cells(j, i) = Cells(k, 30) Then
                        Cells(k, i + 29).Formula = Cells(k, (i + 29)).Value + Cells((j + 2), i).Value
                        l = 1
                        Exit For
                    End If
                Next k
                    If l = 0 Then
                        DernLigne = Range("AD" & Rows.Count).End(xlUp).Row + 1
                        Cells(DernLigne, 30) = Cells(j, i)
                        Cells(DernLigne, 29) = Cells(j - 1, i)
                        Cells(DernLigne, 31) = Cells(j + 1, i)
                        Cells(DernLigne, (i + 29)) = Cells((j + 2), i)
                    End If
            End If
        Next j
    Next i
End Sub
Pourriez-vous m'aider à comprendre où se situe le problème?

Merci!

Ludo