To my fellow custodians of the free world.
Any help on this issue would be appreciated, and many thanks in advance.
I had a sheet with a single pivot table on it (PivotTable1) and I had a macro that would copy the data from this pivot table (PivotTable1) onto another sheet as values only which would then be saved as a PDF which worked fine.
I then added another pivot table (PivotTable10) to the same sheet, to provide additional information, visually only and was not required to be copied etc.
Now when I run the same macro that was copying the data from pivot table (PivotTable1) it's referencing the newly added pivot table (PivotTable10) and I cant get it to reference and copy the data from pivot table (PivotTable1) as it used to.
the section of code that I have narrowed it down top is as follows;
Dim PT As PivotTable
Set PT = ActiveSheet.PivotTables(1)
PT.TableRange1.Select
MsgBox Worksheets("Pivot for Suppliers").PivotTables(1).Name
Selection.Copy
Sheets("Order for Supplier").Select
Range("A7").Select
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Any help on this issue would be appreciated, and many thanks in advance.
I had a sheet with a single pivot table on it (PivotTable1) and I had a macro that would copy the data from this pivot table (PivotTable1) onto another sheet as values only which would then be saved as a PDF which worked fine.
I then added another pivot table (PivotTable10) to the same sheet, to provide additional information, visually only and was not required to be copied etc.
Now when I run the same macro that was copying the data from pivot table (PivotTable1) it's referencing the newly added pivot table (PivotTable10) and I cant get it to reference and copy the data from pivot table (PivotTable1) as it used to.
the section of code that I have narrowed it down top is as follows;
Dim PT As PivotTable
Set PT = ActiveSheet.PivotTables(1)
PT.TableRange1.Select
MsgBox Worksheets("Pivot for Suppliers").PivotTables(1).Name
Selection.Copy
Sheets("Order for Supplier").Select
Range("A7").Select
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False