Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Create a pivot table in VBA

Hi,
I created a macro (recorded macro)to make a pivot Table.
The generated code was the following:
(...)
Columns("A:H").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase,
SourceData:= _
"relat!C1:C8").CreatePivotTable
TableDestination:="", TableName:= _
"TD Vendas"
ActiveSheet.Name = "TPVsIva"
ActiveSheet.PivotTableWizard
TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select

ActiveSheet.PivotTables("TD Vendas").SmallGrid = False

ActiveSheet.PivotTables("TD Vendas").AddFields
RowFields:=Array( _
"Estrutura", "Dados"), PageFields:="Loja"
(...)

When I run the macro, the last line genarates an error
(Addfields Rowfields line).
The error is : "Run Time Error '1004'" with the
message "It was not possible to execute the
Addfields method of the
PivotTables collection"

Which is the problem?
When I recorded the macro everything was OK.

Thanks in advance for your replys,
Bruno
...

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Create a pivot table in VBA

Hi people,

Can annyone help-me with this VBA error?

I forgot to said that I'm working with Excel 2000 with NT 4.

Thaks in advance
Bruno Cost

--
Message posted from http://www.ExcelForum.com

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
how to create pivot table from existing pivot table in excel 2007 Udayraj Dhulekar Excel Discussion (Misc queries) 2 July 8th 13 08:22 PM
can I create pivot table from two other pivot tables? pjk@boro Excel Discussion (Misc queries) 5 June 13th 09 12:13 PM
How do I create multiple pivot charts from one pivot table? Rudy Charts and Charting in Excel 1 March 17th 06 10:01 PM
pivot table: create worksheetsheet using pivot table Pivot Tables and New Worksheets Excel Discussion (Misc queries) 1 June 1st 05 10:01 PM
How do I create a pivot table if the pivot table icon or menu ite. Lynn@WS Charts and Charting in Excel 1 December 16th 04 02:36 AM


All times are GMT +1. The time now is 04:13 AM.

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"