Macros commande

zidoide

XLDnaute Nouveau
Bonjour,

J'aimerais savoir comment faire pour que ma macro dans le fichier en attache, me renvoie toujours au dernier jour de la liste du tableau (pivot)????


Merci d'avance............
 

Hervé

XLDnaute Barbatruc
Bonsoir zidoide, le forum

Si j'ai bien compris la question, essaye comme ceci :



Sub Macro2()
' Macro recorded 06.11.2005 by OEM
'
With ActiveSheet.PivotTables('PivotTable3')
        .PivotCache.Refresh
       
With .PivotFields('DATE')
                .CurrentPage = .PivotItems(.PivotItems.Count).Name
       
End With
End With

End Sub



salut
 

Hervé

XLDnaute Barbatruc
re

Il suffit de boucler sur les tcd :


Sub Macro2()
Dim i As Byte
For i = 1 To ActiveSheet.PivotTables.Count
       
With ActiveSheet.PivotTables(i)
                .PivotCache.Refresh
               
With .PivotFields('DATE')
                                .CurrentPage = .PivotItems(.PivotItems.Count).Name
               
End With
       
End With
Next i
End Sub
Sub Bouton7_QuandClic()


si tu n'a que 2 TCD, tu peux aussi utiliser : for i=1 to 2 , c'est comme tu veux

salut

PS : supprime la ligne Bouton7_QuandClic() du code, elle n'a rien à voir avec ton code, c'est un test.

salut
 

Discussions similaires

Réponses
10
Affichages
226
Réponses
11
Affichages
268

Statistiques des forums

Discussions
312 305
Messages
2 087 084
Membres
103 459
dernier inscrit
Arnocal