Playing back a Pivot Table macros
Hello,
I think that the problem may lie in the TableDestination argument. If "Sheet27" already exists in the workbook, then you may be trying to overwrite an existing pivottable. Since you want it to go into a new sheet, you could add "Dim strDest" to the beginning of your sub and place this line just after your "Sheets.Add" line:
strDest = "Sheet" & Sheets.Count + 1 & "!R3C1"
Finally, change the "TableDestination:="Sheet27!R3C1"" argument to "TableDestination:=strDest". What this will do is ensure that the PivotTable destination is always a new worksheet.
Hope this helps,
Ben
|