pivot macro

T

Tony

Hello,
I have an issue trying to play-back a macro that creates
a pivot table.
Basically, I recorded the creation of a macro in excel
2000 but when I play it a box pops up with this:

Run-Tinme error '1004'
Unable to get the PivotFields property of the PivotTable
class.

The pivot table list box that opens up during the
playback only shows one of the fields I created.

Any ideas?

Here's the macro:

Sub macro2()
Cells.Select
ActiveWorkbook.PivotCaches.Add
(SourceType:=xlDatabase, SourceData:= _
"'wsprod1_https-443_warning_get_1'!
C1:C11").CreatePivotTable TableDestination _
:="", TableName:="PivotTable3",
DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard
TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
ActiveSheet.PivotTables("PivotTable3").PivotFields
("METHOD").Subtotals = Array( _
False, False, False, False, False, False, False,
False, False, False, False, False)
ActiveSheet.PivotTables("PivotTable3").PivotFields
("Description").Subtotals = _
Array(False, False, False, False, False, False,
False, False, False, False, False, False)
ActiveSheet.PivotTables("PivotTable3").AddFields
RowFields:=Array("METHOD", _
"Description"), PageFields:=Array
("Date", "Time", "Type")
ActiveSheet.PivotTables("PivotTable3").PivotFields
("METHOD").Orientation = _
xlDataField
ActiveWorkbook.ShowPivotTableFieldList = True
Columns("B:B").Select
Selection.ColumnWidth = 40
Range("B1").Select
End Sub
 
T

Tom Ogilvy

Your data source appears to be C1:C11. Not sure how you would get more than
one field from that.
 
G

Guest

ha!
I saw that selection but somehow didn't relate it to the
problem I was having.
...put in the correct range and it works like a champ now.

Thanks Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top