Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Getting data from Pivot Table

Hi,

I have created a pivot table grouping data as follow

Item No Country Sales_person Oct_SUM
======= ======= ============ ==========
1 US John 345
Peter 354

UK Andy 235

FR Fred 255

2.....

3.....

4.....

....

I would like to know if it's possible to write some VB
codes to automate the process of creating a seperate
sheet/workbook for each item_no which will include the
other fields (country, sales_person and Oct_SUM)

Thanks a lot!

Cary
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Getting data from Pivot Table

If you move Item No to the Page area, you can use the following code to
create a sheet for each item:

'======================
Sub ExtractPivotPages()
'extracts data for each page field
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Dim wsPivot As Worksheet
Dim ws As Worksheet
Set wsPivot = Worksheets("Pivot")

Set pt = wsPivot.PivotTables(1)
For Each pf In pt.PageFields
For Each pi In pf.PivotItems
pt.PivotFields(pf.Name).CurrentPage = pi.Name
Set ws = Worksheets.Add
ws.Name = pi.Name
wsPivot.UsedRange.Copy
ws.Range("A1").PasteSpecial xlPasteValues
ws.Range("A1").PasteSpecial xlPasteFormats
Next
Next pf

End Sub
'==================================

Cary wrote:
Hi,

I have created a pivot table grouping data as follow

Item No Country Sales_person Oct_SUM
======= ======= ============ ==========
1 US John 345
Peter 354

UK Andy 235

FR Fred 255

2.....

3.....

4.....

...

I would like to know if it's possible to write some VB
codes to automate the process of creating a seperate
sheet/workbook for each item_no which will include the
other fields (country, sales_person and Oct_SUM)

Thanks a lot!

Cary



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

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
View Pivot Table Source data as a Data Table InsomniacFolder Excel Discussion (Misc queries) 6 April 12th 10 05:17 PM
Lookup data in a variable table & retrieve data from a pivot table Shawna Excel Worksheet Functions 3 October 10th 08 11:11 PM
Filter lines containing pivot table and non pivot table data Grover Excel Worksheet Functions 0 September 24th 07 07:20 PM
Pivot Table - Use Other Pivot Table as Data Source WCM Excel Discussion (Misc queries) 1 January 25th 07 06:39 PM
How do I sort pivot table data outside a pivot table Michael Excel Worksheet Functions 1 January 4th 07 02:45 PM


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