#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default pivot macro

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default pivot macro

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

--
Regards,
Tom Ogilvy

Tony wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default pivot macro

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


-----Original Message-----
Your data source appears to be C1:C11. Not sure how you

would get more than
one field from that.

--
Regards,
Tom Ogilvy

Tony wrote in message
...
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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Pivot Table Macro BCNU Excel Discussion (Misc queries) 0 November 14th 06 01:33 AM
macro for a pivot anu Excel Discussion (Misc queries) 2 August 11th 06 04:48 PM
pivot tables macro Hru48 Excel Discussion (Misc queries) 14 July 6th 06 04:25 PM


All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"