Sub TCD_échéancier()
Der = ActiveSheet.Cells(Rows.count, "A").End(xlUp).Row
For i = 2 To Der
If Range("M" & i) = 0 Then
Rows(i).Insert
Exit For
End If
Next
Range("A1:N1").Select
Range(Selection, Selection.End(xlDown)).Select
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Feuil1!R1C1:R" & i - 1 & "C14", Version:=6).CreatePivotTable TableDestination:= _
"Feuil2!R3C1", TableName:="Tableau croisé dynamique1", DefaultVersion:=6
Sheets("Feuil2").Select
With ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotFields( _
"FER MON")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotFields("Article" _
)
.Orientation = xlDataField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotFields("Domaine" _
)
.Orientation = xlRowField
.Position = 2
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotFields( _
"Semaine échéancier")
.Orientation = xlColumnField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotFields( _
"Reste a livr.")
.Orientation = xlPageField
.Position = 1
End With
End Sub