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
| Dim PTCache As PivotCache
Dim PT As PivotTable
Application.ScreenUpdating = False
On Error Resume Next
Application.DisplayAlerts = False
Sheets("Tableau").Delete
Worksheets.Add
ActiveSheet.Name = "Tableau"
Application.DisplayAlerts = True
Sheets("Donnees").Select
Set PTCache = ActiveWorkbook.PivotCaches.Add _
(SourceType:=xlDatabase, _
SourceData:=Range("A1").CurrentRegion.Address)
Set PT = PTCache.CreatePivotTable _
(TableDestination:="'Tableau'!R5C1", _
TableName:="LeTableau")
With PT
.PivotFields("CODEEMP").Orientation = xlRowField
.PivotFields("CODEEMP").Position = 1
.PivotFields("NOM-prenom").Orientation = xlRowField
.PivotFields("NOM-prenom").Position = 2
.PivotFields("HEURE").Orientation = xlRowField
.PivotFields("HEURE").Position = 3
.PivotFields("HEURE").Subtotals = Array(False, False, False, False, False, False, False, False, False, False, False, False)
.PivotFields("HEURE").PivotItems("").Visible = False
.PivotFields("DESIGNATION 200").Orientation = xlRowField
.PivotFields("DESIGNATION 200").Position = 4
.PivotFields("SEMAINE").Orientation = xlColumnField
.PivotFields("SEMAINE").Position = 1
.PivotFields("NBHRS").Orientation = xlDataField
.PivotFields("Somme de NBHRS").NumberFormat = "0.00"
.PivotFields("CODEEMP").Subtotals = Array(False, False, False, False, False, False, False, False, False, False, False, False)
End With
Sheets("Tableau").Select
Application.CommandBars("PivotTable").Visible = False
Application.ScreenUpdating = True |
Partager