macro on pivot tables / pivot items
Markx,
This will work for the row field "Name" in a pivottable named PivotTable1
Sub PrintPTMacro()
Dim i As Integer
Dim j As Integer
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Name")
For i = 1 To .PivotItems.Count
.PivotItems(i).Visible = True
For j = 1 To .PivotItems.Count
If j < i Then .PivotItems(j).Visible = False
Next j
ActiveSheet.PrintOut
MsgBox .PivotItems(i).Name & " is now printing"
Next i
End With
End Sub
HTH,
Bernie
MS Excel MVP
"markx" wrote in message
...
Hi Guys,
Do you know how to print all the pivot items separately (instead of printing the whole pivot
table...)?
Intuitively I think about a macro that will show one pivot item after another then print the page,
but I'm failing to achieve this through VBA coding, since already 3 days (and nights)... :-(
Thanks for any hints/help on this,
Regards,
Markx
|