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 95 96 97 98 99 100 101 102 103 104 105
| Sub Traitement_Operations()
' ELIMINATION DES COLONNES INUTILES
' ***************************************
lin = 1
col = 1
Do Until Cells(lin, col) = ""
If Cells(lin, col) Like "*Libelle operation*" _
Or Cells(lin, col) Like "*Debit*" _
Or Cells(lin, col) Like "*Credit*" _
Or Cells(lin, col) Like "*Date operation*" Then
col = col + 1
Else
Columns(col).Delete
End If
Loop
' REORGANISATION DES COLONNES
' **********************************
Columns("A:A").Insert Shift:=xlToRight
Columns("E:E").Cut
Columns("A:A").Select
ActiveSheet.Paste
Range("A1").Select
' DEBITS ET CREDITS SUR UNE SEULE COLONNE
' **********************************************
lin = 2
col = 1
Do Until Cells(lin, col) = ""
If Cells(lin, 4) <> "" Then
Cells(lin, 3) = Cells(lin, 4)
End If
lin = lin + 1
Loop
Columns(4).Delete
' FORMATAGE DES MONTANTS
' *****************************
Columns("C:C").NumberFormat = "#,##0.00"
' LARGEUR DES COLONNES ET CENTRAGE LIBELLES
' *************************************************
ActiveSheet.UsedRange.EntireColumn.AutoFit
Rows("1:1").HorizontalAlignment = xlCenter
' COULEUR DE L'ONGLET
' ***********************
With ActiveSheet.Tab
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.799981688894314
End With
' RENOMMAGE DE L'ONGLET
' ***************************
mois = Application.InputBox(Prompt:="Nom du mois concern ?", Type:=2)
ActiveSheet.Name = mois
' Calcul du solde
' ***************************
Dim Solde_depart As Double
Dim Solde As Double
L = 2
Compteur = 0
Solde_depart = Application.InputBox(Prompt:="Solde du mois prcdent ?", Type:=1)
Solde = Solde_depart
Cells(1, 5) = "Solde"
Do Until Cells(L, 1) = ""
Compteur = Compteur + 1
L = L + 1
Loop
lin = L - 1
For k = Compteur To 1 Step -1
Solde = Solde + Cells(lin, 3)
Cells(lin, 5) = Solde
lin = lin - 1
Next
' FORMATAGE DES MONTANTS POUR LE SOLDE
' *****************************
Columns("E:E").NumberFormat = "#,##0.00"
Range("A1").Select
End Sub |
Partager