ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot Table Code - Simple Code Fix? (https://www.excelbanter.com/excel-programming/408809-pivot-table-code-simple-code-fix.html)

J.W. Aldridge

Pivot Table Code - Simple Code Fix?
 
For an expert, this should be a simple fix.....

(at least I assume that it is....)

The following code works, but only for one or two pivot tables on the
worksheet. I have about 12 pivot tables on the same worksheet and I
need them all to refer to A1 for the source data.

What ammendments are needed?




Sub Test()

ActiveSheet.PivotTables(1).SourceData =
Application.ConvertFormula([a1], xlA1, xlR1C1)

End Sub




Thanx

Jim Thomlinson

Pivot Table Code - Simple Code Fix?
 
Keep in mind that this is just a shot in the dark...

Sub Test()
dim pvt as pivottable

for each pvt in activesheet.pivottalbles
pvt.SourceData = Application.ConvertFormula([a1], xlA1, xlR1C1)
next pvt
End Sub


--
HTH...

Jim Thomlinson


"J.W. Aldridge" wrote:

For an expert, this should be a simple fix.....

(at least I assume that it is....)

The following code works, but only for one or two pivot tables on the
worksheet. I have about 12 pivot tables on the same worksheet and I
need them all to refer to A1 for the source data.

What ammendments are needed?




Sub Test()

ActiveSheet.PivotTables(1).SourceData =
Application.ConvertFormula([a1], xlA1, xlR1C1)

End Sub




Thanx


J.W. Aldridge

Pivot Table Code - Simple Code Fix?
 
tried it but.....

Error message: object doesnt support this property or method.


Any clues?


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com