Hi All,
I am doin a macro that will be run weekly. I recorded a pivot table an
this is the code that i got from it but it giving me an error on th
line with *** beside it (something to do with "PivotTable7"???):
Sub PivotTable()
'
' PivotTable Macro
' Macro recorded 7/27/2004 by Cathal
'
'
Range("A5:P373").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"Sheet2!R5C1:R373C16").CreatePivotTable TableDestination:= _
"'[Copy of testda****again.xls]Agr types'!R2C1:R24C13", TableName:= _
"PivotTable7", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTables("PivotTable7").AddFields RowFields:=Array( _
*** "Assigned Agent", "Data"), ColumnFields:="Agreement Type"
With ActiveSheet.PivotTables("PivotTable7").PivotFields ("Num Days t
Close")
.Orientation = xlDataField
.Caption = "Average of Num Days to Close"
.Position = 1
.Function = xlAverage
End With
ActiveSheet.PivotTables("PivotTable7").PivotFields ("Cas
ID").Orientation = _
xlDataField
ActiveWorkbook.ShowPivotTableFieldList = True
ActiveWindow.SmallScroll Down:=15
Range("A1:N47").Select
Range("N47").Activate
Selection.NumberFormat = "0"
ActiveWindow.LargeScroll ToRight:=-1
ActiveSheet.PivotTables("PivotTable7").PivotSelect "", xlBlanks, True
Range("C8").Select
ActiveSheet.PivotTables("PivotTable7").RowGrand = False
End Sub
If any one could help me with this it would be great.
Thanks in advance.
Cathal
--
Message posted from
http://www.ExcelForum.com