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

G'Day All,

I have a workbook that has a Worksheet containing raw data read from an
Access database using VBA/ADODB using criteria selected from a UserForm.

Several other Sheets contain summary reports of various kinds assembled
from the Raw Data using VBA.

I would like to construct two Pivot Tables/Charts based on the Raw Data.

How may I update the underlying range of these, when the raw data range
changes from time to time depending on the criteria?
--
Regards,
Pat Garard
Melbourne, Australia
_______________________


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Change Pivot Table Range

Pat,

This is a scheme that works for me.
1) use a named range (PIVDATA) as the source of the pivot table
2) use VBA to set the range you would like to that name (PIVDATA)
3) use VBA to refresh all the pivot tables in the workbook

For step 1 : OPEN PIVOT TABLE WIZARD and enter the named range at step 2 of 3

For step 2 something like this. Assume B1 is a cell in the range you want
to use in the pivot table then:


"Pat Garard" wrote:

G'Day All,

I have a workbook that has a Worksheet containing raw data read from an
Access database using VBA/ADODB using criteria selected from a UserForm.

Several other Sheets contain summary reports of various kinds assembled
from the Raw Data using VBA.

I would like to construct two Pivot Tables/Charts based on the Raw Data.

How may I update the underlying range of these, when the raw data range
changes from time to time depending on the criteria?
--
Regards,
Pat Garard
Melbourne, Australia
_______________________



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Change Pivot Table Range

Pat,

Here is a scheme that works for me.
1) Name the range the pivot table refers to (PIVDATA)
2) use VBA to change what that name refers to - the range you'd like to use
in the current instance
3) use VBA to refresh the pivot tables after the name change

For Step 1 : open the pivot table Wizzard and set the range in step 2 of 3
to PIVDATA
For Step 2: assume B1 is a cell in the range you'd like to use
range("B1").select
activecell.currentregion.name = "PIVDATA"
For Step3:
for each PT in activesheet.pivottables
.refreshtable
next

Step 2 and 3 can be tied to buttons or called from the macro that determines
which range you need to view.

This assumes the categories you are using in your pivot tables will stay
pretty much unchanged from range to range. If they don't then the selections
available will get messy fast.

Regards,
Mike

"Pat Garard" wrote:

G'Day All,

I have a workbook that has a Worksheet containing raw data read from an
Access database using VBA/ADODB using criteria selected from a UserForm.

Several other Sheets contain summary reports of various kinds assembled
from the Raw Data using VBA.

I would like to construct two Pivot Tables/Charts based on the Raw Data.

How may I update the underlying range of these, when the raw data range
changes from time to time depending on the criteria?
--
Regards,
Pat Garard
Melbourne, Australia
_______________________



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 change pivot table to change data jacob22 Excel Discussion (Misc queries) 2 April 11th 07 03:32 PM
change range for pivot table on refresh Dan Excel Discussion (Misc queries) 2 March 7th 06 11:32 PM
Change the range of a pivot table data source Tony White[_2_] Excel Programming 3 July 11th 05 07:46 PM
Macro to change a Pivot Table David M Excel Discussion (Misc queries) 0 March 22nd 05 05:27 PM
Pivot Table/ % Change Debra Dalgleish Excel Programming 0 February 19th 05 01:27 AM


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