Bonjour,
J'ai créé un code permettant de traiter des données et de creer un TCD.
Une fois ce TCD creer j'aimerais trier les données.
Voila mon code qui crée le tCD:
Code :
Sub CreerTCD1()
Dim DerCol As Integer, DerLig As Long, CelAdr As String
DerCol = shtPoidsSem.Cells(1, Columns.Count).End(xlToLeft).Column
DerLig = shtPoidsSem.Range("A" & Rows.Count).End(xlUp).Row
CelAdr = Cells(DerLig, DerCol).Address
shtPoidsSem.Select
Range("A1").Select
ThisWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
shtPoidsSem.Range("A1:" & CelAdr).Address(, , xlR1C1, True)).CreatePivotTable _
Sheets("Graf Sem").Range("A2"), TableName:="TCD1"
Sheets("Graf Sem").PivotTables("TCD1").SmallGrid = False
Sheets("Graf Sem").PivotTables("TCD1").AddFields RowFields:="Almacén"
With Sheets("Graf Sem").PivotTables("TCD1").PivotFields("Neto Báscula")
.Orientation = xlDataField
.Caption = "Promedio de neto"
.Function = xlAverage
End With
Application.CommandBars("PivotTable").Visible = False
End Sub
Je voulais mettre un xlsortvalues mais ca ne marche pas avez vous une idée de comment je peux faire?
Merci d'aider un debutant.