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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| For i = 18 To derniere_ligne_journal
If Sheets("Journal").Range("F" & i) = compte_financier And Left(Sheets("Journal").Range("E" & i), 7) = "Extrait" Then
Range("B" & ligne_insertion) = Sheets("Journal").Range("E" & i)
Range("C" & ligne_insertion) = Sheets("Journal").Range("C" & i)
Range("C" & ligne_insertion).NumberFormat = "dd/mm/yyyy;@"
Range("C" & ligne_insertion).HorizontalAlignment = xlCenter
If Sheets("Journal").Range("D" & i) = "" Then
Range("D" & ligne_insertion) = "*** Dépot cash ***"
Else
Range("D" & ligne_insertion) = Sheets("Journal").Range("D" & i)
End If
Range("E" & ligne_insertion) = Sheets("Journal").Range("L" & i)
Range("F" & ligne_insertion) = Sheets("Journal").Range("J" & i)
Range("F" & ligne_insertion).NumberFormat = "0.00"
ligne_insertion = ligne_insertion + 1
End If
If Sheets("Journal").Range("H" & i) = compte_financier And Left(Sheets("Journal").Range("E" & i), 7) = "Extrait" Then
Range("B" & ligne_insertion) = Sheets("Journal").Range("E" & i)
Range("C" & ligne_insertion) = Sheets("Journal").Range("C" & i)
Range("C" & ligne_insertion).NumberFormat = "dd/mm/yyyy;@"
Range("C" & ligne_insertion).HorizontalAlignment = xlCenter
If Sheets("Journal").Range("D" & i) = "" Then
Range("D" & ligne_insertion) = "*** Retrait cash ***"
Else
Range("D" & ligne_insertion) = Sheets("Journal").Range("D" & i)
End If
Range("E" & ligne_insertion) = Sheets("Journal").Range("L" & i)
Range("F" & ligne_insertion) = 0 - Sheets("Journal").Range("J" & i)
Range("F" & ligne_insertion).NumberFormat = "0.00"
ligne_insertion = ligne_insertion + 1
End If
Next
' mise en forme de la feuille
compteur_lignes = Range("B10").End(xlDown).Row 'nombre de lignes dans le tableau après mise en forme (insertion lignes)
If compteur_lignes = 1048576 Then compteur_lignes = 10
derligne = Range("B10").End(xlDown).Row
If derligne = 1048576 Then derligne = 10
Range("B10").Font.Color = RGB(255, 0, 0) 'rouge
For i = derligne + 1 To 11 Step -1
If Range("B" & i) = Range("B" & i - 1) Then
Range("B" & i) = ""
Range("C" & i) = ""
Else
Range("B" & i & ":" & "F" & i).Borders(xlEdgeTop).LineStyle = xlContinuous
Range("B" & i).Font.Color = RGB(255, 0, 0) 'rouge
Range("B" & i).Font.Color = RGB(255, 0, 0) 'rouge
Range("G" & i).EntireRow.Insert
compteur_lignes = compteur_lignes + 1
Range("G" & i).EntireRow.Insert
compteur_lignes = compteur_lignes + 1
Range("G" & i).EntireRow.Insert
compteur_lignes = compteur_lignes + 1
Range("E" & i + 1) = "Solde de l'extrait : "
Range("E" & i + 1).Font.Italic = True
Range("E" & i + 1).Font.Bold = True
Range("E" & i + 1).HorizontalAlignment = xlRight
End If
Next
' calcul du solde
Dim solde As Double
Dim montant As Double
solde = Range("F8").Value
For i = 10 To compteur_lignes
If Range("F" & i) <> "" Then
montant = montant + Range("F" & i).Value
Else
solde = solde + montant
Range("F" & i + 1) = solde
Range("F" & i + 1).Font.Italic = True
Range("F" & i + 1).Font.Bold = True
Range("F" & i + 1).Borders.Weight = 2
Range("F" & i + 1).Borders.Color = RGB(255, 0, 0) 'rouge
montant = 0
i = i + 2
End If
Next |
Partager