malek-farid
XLDnaute Junior
Pour mon analyse comptable une macro a etait réaliser que me fasse ressortir une analyse de compte entre la colonne DEBIT ET CREDIT qui ont un montant identique avec des critères E_ENR , CODE_CG, CODE_AT, DEBIT , CREDIT
Sub test()
Range("L2:L65536").ClearContents
Sheets("Feuil1").Range("A2:K65536").ClearContents
If Sheets("Feuil1").Range("A65536").End(xlUp).Row > 2 Then Sheets("Feuil1").Range("A2:K" & Sheets("Feuil1").Range("A65536").End(xlUp).Row).ClearContents
'ligne = 2
tablo = Range("A2:K" & Range("A65536").End(xlUp).Row)
For n = LBound(tablo, 1) To UBound(tablo, 1) - 1
For m = n + 1 To UBound(tablo, 1)
If tablo(n, 4) & tablo(n, 5) & tablo(n, 10) = tablo(m, 4) & tablo(m, 5) & tablo(m, 11) Then
If tablo(n, 10) <> 0 And tablo(m, 11) <> 0 Then
Range("L" & n + 1) = "X"
Range("L" & m + 1) = "X"
End If
End If
Next m
Next n
For n = 2 To Range("A65536").End(xlUp).Row
If Range("L" & n) = "" Then
Range("A" & n & ":K" & n).Copy Destination:=Sheets("Feuil1").Range("A65536").End(xlUp).Offset(1, 0)
End If
Next n
Sheets("Feuil1").Select
End Sub
J'ai applique cet macro pour le fichier qui arrive en fin annee a 656000
sa prends beaucoup de temps
serait possible de rajouter la sélections avec un choix pour un CODE_CG et CODE_AT
ou un autre solution
Mercie de voutre aide
Sub test()
Range("L2:L65536").ClearContents
Sheets("Feuil1").Range("A2:K65536").ClearContents
If Sheets("Feuil1").Range("A65536").End(xlUp).Row > 2 Then Sheets("Feuil1").Range("A2:K" & Sheets("Feuil1").Range("A65536").End(xlUp).Row).ClearContents
'ligne = 2
tablo = Range("A2:K" & Range("A65536").End(xlUp).Row)
For n = LBound(tablo, 1) To UBound(tablo, 1) - 1
For m = n + 1 To UBound(tablo, 1)
If tablo(n, 4) & tablo(n, 5) & tablo(n, 10) = tablo(m, 4) & tablo(m, 5) & tablo(m, 11) Then
If tablo(n, 10) <> 0 And tablo(m, 11) <> 0 Then
Range("L" & n + 1) = "X"
Range("L" & m + 1) = "X"
End If
End If
Next m
Next n
For n = 2 To Range("A65536").End(xlUp).Row
If Range("L" & n) = "" Then
Range("A" & n & ":K" & n).Copy Destination:=Sheets("Feuil1").Range("A65536").End(xlUp).Offset(1, 0)
End If
Next n
Sheets("Feuil1").Select
End Sub
J'ai applique cet macro pour le fichier qui arrive en fin annee a 656000
sa prends beaucoup de temps
serait possible de rajouter la sélections avec un choix pour un CODE_CG et CODE_AT
ou un autre solution
Mercie de voutre aide