Private Sub Ecrire_Champs_TCD_Colonne(TCD As PivotTable, Liste)
Dim nb As Long, i As Long, tag As Boolean
Do While TCD.ColumnFields.Count <> 0
TCD.ColumnFields(1).Orientation = xlHidden
Loop
If Not IsEmpty(Liste) Then
nb = UBound(Liste)
For i = 1 To nb
tag = (InStrRev(Liste(i), TCD_Tag_Sous_Total) > 0)
If tag Then Liste(i) = Left(Liste(i), InStr(1, Liste(i), TCD_Tag_Sous_Total) - 1)
With TCD.PivotFields(Liste(i))
.Orientation = xlColumnField
.Subtotals = Array(tag, False, False, False, False, False, False, False, False, False, False, False)
End With
Next i
End If
End Sub
Private Sub Ecrire_Champs_TCD_Ligne(TCD As PivotTable, Liste)
Dim nb As Long, i As Long, tag As Boolean
Do While TCD.RowFields.Count <> 0
TCD.RowFields(1).Orientation = xlHidden
Loop
If Not IsEmpty(Liste) Then
nb = UBound(Liste)
For i = 1 To nb
tag = (InStrRev(Liste(i), TCD_Tag_Sous_Total) > 0)
If tag Then Liste(i) = Left(Liste(i), InStr(1, Liste(i), TCD_Tag_Sous_Total) - 1)
With TCD.PivotFields(Liste(i))
.Orientation = xlRowField
.Subtotals = Array(tag, False, False, False, False, False, False, False, False, False, False, False)
End With
Next i
End If
End Sub
Private Sub Ecrire_Champs_TCD_Page(TCD As PivotTable, Liste)
Dim nb As Long, i As Long
Do While TCD.PageFields.Count <> 0
TCD.PageFields(1).Orientation = xlHidden
Loop
If Not IsEmpty(Liste) Then
nb = UBound(Liste)
For i = 1 To nb
TCD.PivotFields(Liste(i)).Orientation = xlPageField
Next i
End If
End Sub
Private Sub Ecrire_Champs_TCD_Valeur(TCD As PivotTable, Liste)
Dim nb As Long, i As Long
Do While TCD.DataFields.Count <> 0
TCD.DataFields(1).Orientation = xlHidden
Loop
If Not IsEmpty(Liste) Then
nb = UBound(Liste, 1)
For i = 1 To nb
With TCD.PivotFields(Liste(i, 1))
.Orientation = xlDataField
.Caption = Liste(i, 2) + TCD_Fonction_Séparation + Liste(i, 1)
If Not IsEmpty(Liste(i, 3)) Then .Function = Liste(i, 3)
End With
Next i
End If
End Sub