ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   pivot table macro (https://www.excelbanter.com/new-users-excel/187049-pivot-table-macro.html)

skippy51

pivot table macro
 
I want to create a pivot table using the pivot table wizzard from a worksheet
into a worksheet with the name table by running a macro. when I record the
macro I create the pivot table using the wizzard and it works fine but when I
try to run the macro again it errors "unable to get the pivot tables property
of the worksheet class" any help?

Roger Govier[_3_]

pivot table macro
 
Hi

Post the code you have created

--
Regards
Roger Govier

"skippy51" wrote in message
...
I want to create a pivot table using the pivot table wizzard from a
worksheet
into a worksheet with the name table by running a macro. when I record the
macro I create the pivot table using the wizzard and it works fine but
when I
try to run the macro again it errors "unable to get the pivot tables
property
of the worksheet class" any help?



skippy51

pivot table macro
 
Sub pivottest1()
'
' pivottest1 Macro
' Macro recorded 5/11/2008 by Skip Bryczek
'

'
Sheets("temps").Select
Cells.Select
Selection.Clear
Range("A1").Select
Sheets("Temp_report").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"Temp_report!R1C1:R697C16").CreatePivotTable TableDestination:= _
"'[Scanner Readings test1.xls]temps'!R1C1",
TableName:="PivotTable1", _
DefaultVersion:=xlPivotTableVersion10
With ActiveSheet.PivotTables("PivotTable1")
.ColumnGrand = False
.PageFieldOrder = xlOverThenDown
.PageFieldWrapCount = 8
.RowGrand = False
End With
ActiveSheet.PivotTables("PivotTable1").AddFields RowFields:="Asset", _
ColumnFields:="Item"
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Reading")
.Orientation = xlDataField
.Caption = "Average of Reading"
.Function = xlAverage
End With
ActiveWorkbook.ShowPivotTableFieldList = False
End Sub


"Roger Govier" wrote:

Hi

Post the code you have created

--
Regards
Roger Govier

"skippy51" wrote in message
...
I want to create a pivot table using the pivot table wizzard from a
worksheet
into a worksheet with the name table by running a macro. when I record the
macro I create the pivot table using the wizzard and it works fine but
when I
try to run the macro again it errors "unable to get the pivot tables
property
of the worksheet class" any help?





All times are GMT +1. The time now is 11:07 AM.

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