LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default pivot tables macro


Hey,

I’m having a lot of trouble with pivot tables. I am trying to get a
macro to create them automatically by taking data from one sheet and
making a pivot table in another (‘SheetRef’).

I can get it to work if I create a blank sheet for each new pivot by
changing the table destination to “”. But when I try to specify that I
want them to be created on a specific sheet I get an error.

I have been trying to put the sheet name in the table desitnation:

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"'01'!R8C1:R477C2").CreatePivotTable TableDestination:= HERE,
_
TableName:="PivotTable1"

Am I doing something wrong? If someone can point me in the right
direction I would really appreciate it. I have put the whole recording
of createing th pivot underneath if that helps?

Cheers

Hayley



Range("A8:B8").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:=
_
"'01'!R8C1:R477C2").CreatePivotTable
TableDestination:=Range("G1"), _
TableName:="PivotTable1"
ActiveSheet.PivotTables("PivotTable1").SmallGrid = False
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Agent
Number/Name")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("Campaign
Type")
.Orientation = xlDataField
.Position = 1
End With
Application.CommandBars("PivotTable").Visible = False
End Sub


--
Hru48
------------------------------------------------------------------------
Hru48's Profile: http://www.excelforum.com/member.php...o&userid=24895
View this thread: http://www.excelforum.com/showthread...hreadid=558821

 
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
2 Pivot tables on 1 sheet TheRook Excel Discussion (Misc queries) 1 June 14th 06 01:01 PM
two Pivot Tables One pivot chart cereldine Excel Discussion (Misc queries) 1 March 3rd 06 02:32 PM
Pivot Tables venetianjigsaw Excel Discussion (Misc queries) 0 February 13th 06 02:51 PM
Data Cubes and Pivot Tables venetianjigsaw Excel Worksheet Functions 0 February 10th 06 07:48 PM
Pivot tables - inserting columns Scott Excel Worksheet Functions 1 March 19th 05 01:07 AM


All times are GMT +1. The time now is 03:13 PM.

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

About Us

"It's about Microsoft Excel"