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
| Application.ScreenUpdating = False
Columns("D:E").Select
Selection.Replace What:=".", Replacement:=",", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("F:F").Select
Selection.Insert Shift:=xlToRight
Range("F1").Select
ActiveCell.FormulaR1C1 = "Montant solde"
With Worksheets(1)
LastLig = .Cells(.Rows.Count, 1).End(xlUp).Row
Tb = .Range("A1:F" & LastLig)
Tb(1, 6) = "Montant soldé"
For i = 2 To LastLig
Tb(i, 6) = Tb(i, 4) - Tb(i, 5)
Next i
.Range("A1:F" & LastLig) = Tb
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = False
Range("A1:R65000").Select
Application.CutCopyMode = False
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"A1:R65000").CreatePivotTable TableDestination:="", TableName:= _
"Tableau croisé dynamique1", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
ActiveSheet.PivotTables("Tableau croisé dynamique1").AddFields RowFields:= _
Array("CGR A", "Poste", "Libellé réduit du compte", "Libellé", "Libellé écriture", _
"Date Compt", "Pièce", "Ets")
With ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotFields( _
"Montant soldé")
.Orientation = xlDataField
End With |
Partager