Copying from Excel to Excel

Sharkie21

Active Member
Joined
Nov 2, 2005
Messages
319
I'm trying to copy all my PT from one work book to the other without having the links just the table.

My code doesn't seem to paste anything though.
Code:
Public Sub ExportExcelChart(xlsObj As Excel.Application)

Dim Pt As PivotTable
Dim Wsht As Worksheet
On Error Resume Next
For Each Wsht In ThisWorkbook.Worksheets
For Each Pt In Wsht.PivotTables
    Pt.PivotSelect "", xlDataAndLabel
    Selection.Copy
    xlsObj.Selection.Paste
Next Pt
Next Wsht

End Sub
 

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Sharkie21

Active Member
Joined
Nov 2, 2005
Messages
319
Prior to the method call I have this.

Dim xlsObj As Excel.Application
Dim xlswk As Excel.Workbook
Dim xlswks As Excel.Worksheet
Set xlsObj = CreateObject("Excel.Application.9")
xlsObj.Visible = True
Set xlswk = xlsObj.Workbooks.Add
 

Sharkie21

Active Member
Joined
Nov 2, 2005
Messages
319
bump.

It doesn't seem like it's copying. When I break into the code after
selection.copy I go to another app and put paste and nothing happens.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,530
Messages
5,572,675
Members
412,481
Latest member
nhantam
Top