here was my project:
I created a pivot table from a central Excel file on item pricing and data. I did "show filter pages" to create different worksheets for each unique entry in a particular field (created in excess of 100 worksheets). I moved all the resulting PivotTable sheets to their own workbook (titled PivotTableResults).
What I want to do is automate the copying of the PivotTable data, then paste as values in the next available blank row below the PivotTable. Then paste the same PivotTable again to retain the formatting, for ALL worksheets in the book.
I followed this advice on accomplishing the PivotTable pasting values/formatting: http://spreadsheetpage.com/index.php/tip/unlinking_a_pivot_table_from_its_source_data/
Here's my current code:
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim pt As PivotTable
Set pt = ActiveSheet.PivotTables(1)
For Each ws In ActiveWorkbook.Worksheets
Dim NextRow As Range
Set NextRow = ws.Cells(Cells.Rows.Count).End(xlUp).Offset(1)
For Each pt In ws.PivotTables
'ws.PivotTables("pt").PivotSelect "", xlDataAndLabel, True
pt.TableRange2.Copy
Set CurrentRow = NextRow
CurrentRow.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
CurrentRow.Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Next pt
Next ws
End Sub
Any suggestions?