Discussion: tableau croisé
Afficher un message
Vieux 16/04/2006, 10h00   #7 (permalink)
MichelXld
XLDnaute Barbatruc
 
Date d'inscription: février 2005
Messages: 3 855
Par défaut Re:tableau croisé

bonjour Didier , bonjour cher Dan

il existe plusieurs solutions , mais ce n'est pas évident de répondre sans voir ton classeur

voici un exemple en utilisant la méthode GetData , comme proposé par mon ami Dan
(le TCD est dans la Feuil4 )


Private Sub UserForm_Initialize()
Dim Cell As Range
Dim Pvt As PivotTable
Dim Pvf As PivotField

ListBox1.ColumnCount = 2
ListBox1.ColumnWidths = '70;40'

Set Pvt = Sheets('Feuil4').PivotTables(1)
Set Pvf = Pvt.PivotFields(1)

For Each Cell In Pvf.DataRange

ListBox1.AddItem Cell

ListBox1.List(ListBox1.ListCount - 1, 1) = _
Sheets('Feuil4').PivotTables(1).GetData(''' & Pvt.DataFields(1).Name & '' ' _
& Pvf.Name & ' ' & Cell)

Next Cell
End Sub




bonne journée
MichelXld

Message édité par: michelxld, à: 16/04/2006 09:03
MichelXld est déconnecté   Réponse avec citation