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

I am wondering if it is possible to update a PivotTable, based on data set in
another worsheet? I have to create a summary report with variable data set
in my "Report" worksheet. I can manually update the PivotTable with the
variable data when in the PivotTable worksheet. However, I would like to
keep the PivotTable data manipulation out of the hands of the users. In
other words, I would prefer them to input pertainant information through an
input dialog and print a report based on criteria set in the "Report"
worksheet.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Pivot Table Help

you can use another excel workbook as if it were another data source. You can
create a new pivot table using the Data/Pivot Table menu an dfollow the wizard

"ASteele" wrote:

I am wondering if it is possible to update a PivotTable, based on data set in
another worsheet? I have to create a summary report with variable data set
in my "Report" worksheet. I can manually update the PivotTable with the
variable data when in the PivotTable worksheet. However, I would like to
keep the PivotTable data manipulation out of the hands of the users. In
other words, I would prefer them to input pertainant information through an
input dialog and print a report based on criteria set in the "Report"
worksheet.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Pivot Table Help

here's some sample coe that you can adapt ....


Sub BuildPivot()

Dim Conn As ADODB.Connection
Dim RST As ADODB.Recordset
Dim strConn As String
Dim SQL As String
Dim ws As Worksheet
Dim cl As Long
Dim pc As PivotCache

Dim sExcelSourceFile As String

sExcelSourceFile = "E:\Excel\Excel_database\Testdatabase.xls"

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel
8.0;"
strConn = strConn & "Data Source="
strConn = strConn & sExcelSourceFile

Set Conn = New ADODB.Connection
Conn.Open strConn

Set RST = New ADODB.Recordset

SQL = "SELECT * from testdata"
RST.Open SQL, Conn, adOpenStatic

Set ws = Worksheets.Add


Set pc = ThisWorkbook.PivotCaches.Add(xlExternal)

Set pc.Recordset = RST
ws.PivotTables.Add pc, Range("B2")
pc.CreatePivotTable ws.Range("B2"), "table1"



Set ws = Nothing


RST.Close

Conn.Close

Set RST = Nothing

Set Conn = Nothing

End Sub


"Patrick Molloy" wrote:

you can use another excel workbook as if it were another data source. You can
create a new pivot table using the Data/Pivot Table menu an dfollow the wizard

"ASteele" wrote:

I am wondering if it is possible to update a PivotTable, based on data set in
another worsheet? I have to create a summary report with variable data set
in my "Report" worksheet. I can manually update the PivotTable with the
variable data when in the PivotTable worksheet. However, I would like to
keep the PivotTable data manipulation out of the hands of the users. In
other words, I would prefer them to input pertainant information through an
input dialog and print a report based on criteria set in the "Report"
worksheet.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Pivot Table Help

Thanks for the sample code. However, I get a compile error message with the
first line of the code. Is this for Excel 2007. I am using Excel 2003.

"Patrick Molloy" wrote:

here's some sample coe that you can adapt ....


Sub BuildPivot()

Dim Conn As ADODB.Connection
Dim RST As ADODB.Recordset
Dim strConn As String
Dim SQL As String
Dim ws As Worksheet
Dim cl As Long
Dim pc As PivotCache

Dim sExcelSourceFile As String

sExcelSourceFile = "E:\Excel\Excel_database\Testdatabase.xls"

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel
8.0;"
strConn = strConn & "Data Source="
strConn = strConn & sExcelSourceFile

Set Conn = New ADODB.Connection
Conn.Open strConn

Set RST = New ADODB.Recordset

SQL = "SELECT * from testdata"
RST.Open SQL, Conn, adOpenStatic

Set ws = Worksheets.Add


Set pc = ThisWorkbook.PivotCaches.Add(xlExternal)

Set pc.Recordset = RST
ws.PivotTables.Add pc, Range("B2")
pc.CreatePivotTable ws.Range("B2"), "table1"



Set ws = Nothing


RST.Close

Conn.Close

Set RST = Nothing

Set Conn = Nothing

End Sub


"Patrick Molloy" wrote:

you can use another excel workbook as if it were another data source. You can
create a new pivot table using the Data/Pivot Table menu an dfollow the wizard

"ASteele" wrote:

I am wondering if it is possible to update a PivotTable, based on data set in
another worsheet? I have to create a summary report with variable data set
in my "Report" worksheet. I can manually update the PivotTable with the
variable data when in the PivotTable worksheet. However, I would like to
keep the PivotTable data manipulation out of the hands of the users. In
other words, I would prefer them to input pertainant information through an
input dialog and print a report based on criteria set in the "Report"
worksheet.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Pivot Table Help

I was hoping to update the PivotTable through VBA. Creating another
PivotTable through the wizard would require the user to know and understand
PivotTables.

"Patrick Molloy" wrote:

you can use another excel workbook as if it were another data source. You can
create a new pivot table using the Data/Pivot Table menu an dfollow the wizard

"ASteele" wrote:

I am wondering if it is possible to update a PivotTable, based on data set in
another worsheet? I have to create a summary report with variable data set
in my "Report" worksheet. I can manually update the PivotTable with the
variable data when in the PivotTable worksheet. However, I would like to
keep the PivotTable data manipulation out of the hands of the users. In
other words, I would prefer them to input pertainant information through an
input dialog and print a report based on criteria set in the "Report"
worksheet.



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
Print Pivot Table headers on pages with Pivot Table tsgoose Excel Worksheet Functions 0 December 9th 08 08:14 PM
Copying values from pivot table to cells outside pivot table richzip Excel Discussion (Misc queries) 4 January 16th 08 11:03 PM
Filter lines with Pivot table and non pivot table columns Grover Charts and Charting in Excel 4 September 28th 07 03:16 AM
Help required with setting up a pivot table with the source on sheet1 to have the pivot table created on sheet called "report" Diana[_5_] Excel Programming 0 August 21st 03 10:19 PM


All times are GMT +1. The time now is 01:32 AM.

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"