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 29 30 31 32 33 34 35
|
'
' Procédure met à jour Dest, rajoute
' dans rDestination les
' Comptes présent dans sources
'
Sub MajDest(rSource As Range, rDest As Range)
Dim i As Integer
Dim j As Integer
j = 2
For i = 2 To rSource.Rows.Count
While (j <= rDest.Rows.Count) And rSource.Cells(i, 1) > rDest.Cells(j, 1)
j = j + 1
Wend
If (rSource.Cells(i, 1) < rDest.Cells(j, 1)) Or (j > rDest.Rows.Count) Then
rDest.Cells(j, 1).EntireRow.Insert xlShiftDown
rDest.Cells(j, 1) = rSource.Cells(i, 1)
rDest.Cells(j, 2) = rSource.Cells(i, 2)
rDest.Cells(j, 3) = 0
j = j + 1
End If
Next
End Sub
Sub RajouteComptes()
Dim rN As Range 'N
Dim rN1 As Range 'N-1
Set rN = Sheets("N").Range("A1").CurrentRegion
Set rN1 = Sheets("N-1").Range("A1").CurrentRegion
MajDest rN, rN1
MajDest rN1, rN
End Sub |
Partager