Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Question How to create a pivot table in a new worksheet by recording a macro

Hey guys,

I am a new member of this forum. I liked the forum.

Right now I am trying to run a macro which will create a pivot table in a new worksheet. I was trying by recording a macro. But it does not work.

Anybody pls help.

Razib
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 587
Default How to create a pivot table in a new worksheet by recording amacro

hi ,

for example with the following data:
range(A1:C5) name: rng


aa bb cc
a1 b1 1
a2 b2 2
a3 b3 3
a4 b4 4


Sub Macro1()
Dim x As String
x = Range("rng")(3)

With ActiveSheet

'PivotTableWizard xlDatabase, names of source range, destination range, name

..PivotTableWizard xlDatabase, Range("rng"), .Range("E6"), "TCD1"

With .PivotTables(1)
.AddFields RowFields:=Range("rng")(1), ColumnFields:=Range("rng")(2)
.PivotFields(x).Orientation = xlDataField
End With

End With
ActiveWorkbook.ShowPivotTableFieldList = False
End Sub




--
isabelle



Le 2012-01-26 03:43, razib a écrit :
Hey guys,

I am a new member of this forum. I liked the forum.

Right now I am trying to run a macro which will create a pivot table in
a new worksheet. I was trying by recording a macro. But it does not
work.

Anybody pls help.

Razib




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
Can I run a macro to create a pivot table? Eqa Excel Discussion (Misc queries) 2 April 8th 07 06:16 AM
How do I create a multi-worksheet pivot table? Holly Excel Worksheet Functions 1 January 23rd 07 10:19 PM
macro to create a pivot table Catie79 Excel Programming 1 November 22nd 05 09:59 PM
Assign a macro to create a pivot table acsugguiyao Excel Programming 2 June 23rd 05 03:04 AM
Macro to create pivot table/ chart Saint Excel Programming 2 July 6th 04 08:29 PM


All times are GMT +1. The time now is 01:59 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"