Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Resourcing Multiple Pivot Tables

I have a document that has multiple pivot tables. All pivots need to be
resourced to the same table within access. Is there a way to do this without
having to resource each table individually?

Thanks
Nick
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default Resourcing Multiple Pivot Tables

Nick Anderson wrote:
I have a document that has multiple pivot tables. All pivots need to be
resourced to the same table within access. Is there a way to do this without
having to resource each table individually?

Thanks
Nick


Create the first PT (using all the column you will need now and later)
on a new worksheet.

Copy the PT, or the entire PT worksheet to a new worksheet, and change
the new PT as needed.

Rinse and repeat.

Mike Alexander recently discussed this he
http://datapigtechnologies.com/blog/...books-in-half/
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Resourcing Multiple Pivot Tables

if you use an ADODB recordset populated from the database table, you can
create an pivotcache then use this to create multiple pivot tables ...


so for an example, i have this in a code module -- do the following if
you're unsure
( ALT+F11,
Insert/Module
Tools/References Microsoft Active DataObjects 2.7 Library
)


Option Explicit
Dim pc As PivotCache
Dim rst As New ADODB.Recordset
Sub LoadDataFromAccess()
Dim MyFile As String
Dim con As New ADODB.Connection
Dim SQL As String
Dim i As Long

MyFile = "Risk.mdb"
SQL = "SELECT * FROM BondTable"
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MyFile
rst.Open SQL, con, adOpenStatic
Set pc = ThisWorkbook.PivotCaches.Add(xlExternal)

' create new pivot tables from the same recordset..
CreateThePivotTable "table1"
CreateThePivotTable "table2"

rst.Close
con.Close
Set rst = Nothing
Set con = Nothing
End Sub

Sub CreateThePivotTable(text As String)

Dim pt As PivotTable
Dim pf As PivotField
Dim ws As Worksheet

Set ws = ThisWorkbook.Worksheets.Add()

With pc
Set .Recordset = rst
Set pt = .CreatePivotTable(ws.Range("C5"))
pt.Name = text
End With

End Sub





"Nick Anderson" wrote in message
...
I have a document that has multiple pivot tables. All pivots need to be
resourced to the same table within access. Is there a way to do this
without
having to resource each table individually?

Thanks
Nick


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
Pivot tables - Editing the data source shared by multiple pivot ta sankat Excel Discussion (Misc queries) 1 April 22nd 10 03:05 PM
Pivot tables using multiple tables Gringarlow Excel Programming 5 March 24th 09 09:37 PM
multiple pivot tables from 1 pivot cache sugargenius Excel Programming 0 February 22nd 07 07:41 PM
build a pivot table from multiple other pivot tables. Gordo Excel Discussion (Misc queries) 1 December 11th 06 08:19 PM
how do I consolidate multiple pivot tables into one pivot table? pkahm Excel Discussion (Misc queries) 0 April 20th 06 09:48 PM


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